mercredi 7 décembre 2016

Finding location of event handler

We have a class containing hundreds of PropertyChanged event listeners. Some of these are slowing the system down and should perform its work in a separate thread. We need to find out which these are.

We have a list of 'Delegate's and for some, the Method.Name property gives reasonable info, for example "<ContainingMethod>b__5_0". But most event handlers uses an observable wrapper and Method.Name equals "Action'2.Invoke" with no context whatsoever. Method.DeclaringType.FullName does not contain anything useful either.

I wonder if there is some other method we can use to find out where the event handler is located. The performance profiler generates a report of how many times each code line has been observed executing. Could we set up something similar to find out what code is called by the event handlers, or get a stack trace at the deepest stack level? Filename + line number or class + method are equally useful.

Other ideas?





Aucun commentaire:

Enregistrer un commentaire