Is there a way to decompile the dynamic proxy classes that NHibernate generates?

I really like to know what happens in dynamic proxy classes generated by NHibernate.

I understand very well which NHibernate dynamic proxies run at a higher level, but it can be convenient to use to decompile them (using Reflector or something similar) during debugging sessions.

So, is there a way to decompile the dynamic proxy classes that NHibernate generates?

+4
source share
3 answers

This can be done using NHibernate 3.2.0 (an older version does not generate proxies themselves). Just recompile the NHibernate source with the DEBUG and DEBUG_PROXY_OUTPUT compilation symbols. NHibernate then writes the module (* .mod) and assembly (generatedAssembly.dll) files to the current directory when creating the proxy type.

+3
source

Just grab the assembly the classes are in and open it with ILSpy .
In the case of dynamically created proxies:
They are also in the assembly. You can put the code in your program, which identifies the assembly in which the generated proxy classes live, and unloads them to disk, and then opens it in ILSpy.

+1
source

If you link to the NHibernate proxy, you can simply download the NHibernate source code, but if you reference the dynamic nhibernate proxy, you generate it at runtime than I don't think you can.

+1
source

All Articles