Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Error when instrumenting IList #7

Open
tribet84 opened this issue Dec 14, 2015 · 7 comments
Open

Error when instrumenting IList #7

tribet84 opened this issue Dec 14, 2015 · 7 comments

Comments

@tribet84
Copy link

I get the following code when generating the following instrumentation for an IList parameter method:

  <match assemblyName="Assembly" className="MyNameSpace">
    <exactMethodMatcher methodName="ProcessShifts" parameters="System.Collections.Generic.IList`1&lt;MyNameSpace.MyClass&gt;" />
  </match>
@Pablissimo
Copy link
Owner

Do you have a quick test-case class and expected output I can unit test against? Or is it actually raising an error?

To be sure, I've not used New Relic for a while but the above looks like what I'd expect for a method that looks like

 public void ProcessShifts(IList<MyClass> shifts) { }

for example.

@tribet84
Copy link
Author

Exactly, that's the method I'm creating the instrumentation for.

The problem is those strange characters: "`1&lt"

@Pablissimo
Copy link
Owner

That's how New Relic's custom profiler used to require generics be specified - it's a mad combination of the backtick notation you sometimes see in reflection (like List`1) and standard generic notation, all HTML encoded.

I take it then that the method isn't getting instrumented when you actually run it? It's possible New Relic changed how the instrumentation files are parsed, will be Christmas before I can replicate if that's the case though.

@Pablissimo
Copy link
Owner

From a support ticket I opened in Jan 2013(!) about how to instrument methods with generic parameters:

image
image

@tribet84
Copy link
Author

I've tried this approach but I can't get it working. I'll open another ticket, let's see if I'm more lucky

@Pablissimo
Copy link
Owner

Sounds like they've changed how that gets specified then, as once upon a time it definitely worked. As a quick test, try removing the whole parameters attribute from the match element, so something like

<match assemblyName="Assembly" className="MyNameSpace">
    <exactMethodMatcher methodName="ProcessShifts" />
  </match>

In theory that'll just match anything with that name irrespective of the parameters (which might be more broad than you want, but that NRConfig has to fall back to in some situations).

@mattmaslin
Copy link

mattmaslin commented Dec 20, 2016

This is an old thread, but I ran into the same problem. What I had to do was use [ ] instead of the < > encoded. So my final looked like:
System.Collections.Generic.List'1[...]

instead of:
System.Collections.Generic.List'1&lt...&gt

to track down the problem, I followed these steps and checked the logs:
https://discuss.newrelic.com/t/relic-solution-building-custom-instrumentation-tracer-factories-from-net-agent-log-files/40648/2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants