Skip to content

Hide AOP code from stacktrace

If an instrumented exception fires an exception the performance logger code will appear multiple times in the stacktrace, making it harder to track down the real source of the problem.

For example, here is a stacktrace for a method that threw an exception:

Unhandled Exception: System.ArgumentException: Failure
   at ExampleApplication.Worker.WorkerImpl.__a$_around_RunOperationB_100663303_o() in C:\Users\hsmith\Dev\csharp-performance-recorder\ExampleApplication\Worker\WorkerImpl.cs:line 16
   at ExampleApplication.Worker.WorkerImpl.__a$_around_RunOperationB_100663303_u(Object[] )
   at PerformanceRecorder.Attribute.PerformanceLoggingAttribute.HandleAround(Object[] arguments, Func`2 method) in C:\Users\hsmith\Dev\csharp-performance-recorder\PerformanceRecorder\Attribute\PerformanceLoggingAttribute.cs:line 26
   at ExampleApplication.Worker.WorkerImpl.__a$_around_RunOperationB_100663303_w_0(Object[] )
   at ExampleApplication.Worker.WorkerImpl.RunOperationB()
   at ExampleApplication.App.ApplicationImpl.__a$_around_RunApplication_100663306_o() in C:\Users\hsmith\Dev\csharp-performance-recorder\ExampleApplication\App\ApplicationImpl.cs:line 20
   at ExampleApplication.App.ApplicationImpl.__a$_around_RunApplication_100663306_u(Object[] )
   at PerformanceRecorder.Attribute.PerformanceLoggingAttribute.HandleAround(Object[] arguments, Func`2 method) in C:\Users\hsmith\Dev\csharp-performance-recorder\PerformanceRecorder\Attribute\PerformanceLoggingAttribute.cs:line 26
   at ExampleApplication.App.ApplicationImpl.__a$_around_RunApplication_100663306_w_0(Object[] )
   at ExampleApplication.App.ApplicationImpl.RunApplication()
   at ExampleApplication.Program.Main(String[] args) in C:\Users\hsmith\Dev\csharp-performance-recorder\ExampleApplication\Program.cs:line 21
Edited by Hector