.net - Practical usages of MethodRental Class? -


According to MSDN, the mode of dynamic modules allows change of the entity. However, due to its limitations, I can not use it practically. Google did not even help me.

Any idea for which category can be done?

It is similar in spirit when combined with it, but with more constraints. To make routine instrumentation for almost any managed method, the ICorProfiler * classes can be used, there are programmers and debuggers who use it to collect information about the process of walking.

You can use the MethodRental in the instrument code for diagnostic purposes. Some examples:

  • Enter / Exclude the Function You Execute Which you can use to get profiling data from you.
  • Device Synchronization Primitives can help you diagnose race conditions.
  • Writing basic blocks can help you determine code coverage.

You can also use MethodRental to increase the efficiency of the existing code. Comes in the brain. You can 'weave' the concerns of security, logging, or other cross-cutting designs in the existing code. However, you will need some other feature (XML, C # library) to express your aspects.

Finally, you can use the MethodDRAIN in the current code "roundabout", i.e. the blocking method calls for a type of runtime polymorphism, for example, if You have a client code that uses some dynamically-generated classes, then to get some configuration via GetConfig , RegistryStore , you can change the IL of the method RegistryStore Gate Config to use the filesystem instead. You can do this without changing the client code.


Comments