Search code examples
c#.netreflector.net-reflector

Using the Reflector API to get decompiled source code


I am looking for some framework that allows decompiling a .NET assembly to get the source code.

I know Reflector offers some sort of API to perform operations on assemblies, when i used it it seems that i only get back IL instructions and not actual source code.

What i would like to do is set some sort of smart unhandled exception handler, that will get me the failing lines of code (for internal debugging purposes).

Is this possible using the Reflector API? what other tools are available to this end?


Solution

  • I wrote a couple of articles that may be helpful for you in doing this.

    http://www.simple-talk.com/dotnet/.net-framework/-.net-reflector-meets-the-codedom/ talks about creating your own language for Reflector to disassmeble to. This is useful for walking language structures that Reflector will throw up to.

    http://www.simple-talk.com/dotnet/.net-tools/hosting-.net-reflector-in-your-own-application/ talks about hosting Reflector in your own code to use the API. This will step you through the process of accessing the API in reflector and accessing its logic.

    I hope this helps at least point you in the direction to get what you need.