Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to pass all arguments to a wrapper function in .NET Profiler with ILRewrite?

$
0
0

Hi ,

I want to make a profiler like New Relic's .NET agent, but I get some trouble.
The effect just like the output below.

a C# method like:
int Foo(int a, int b, int c)
{
    Console.Writeline("a={0}, b={1}, c={2}",a, b ,c);
    return (a+b+c);
}

when invoke Foo(1,2,3);
1.before injection output:
a=1,b=2,c=3

2.after injection output:
method(Foo) has three arguments:1,2,3.
 a=1,b=2,c=3
method(Foo)  return 6.

I have read 
https://msdn.microsoft.com/en-us/library/bb384493%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
http://www.codeproject.com/Articles/17275/Really-Easy-Logging-using-IL-Rewriting-and-the-NET
but I don't know how to pass all arguments.

Thanks a lot!



Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>