I need to debug a program written in .NET C#.
Specifically – all I need is to see what the function returns after it’s call. I found that I can use for this purpose Microsoft Visual Studio – it understand IL. I get the source code of that exe-file using ILDASM. Than I get pdb file and use ILASM to get exe-file from IL-code. But original exe file is differ from exe-file that I get after ILASM.
Program starts but I have AccessViolation цhen I try to execute the function, the result of which I need to see. Program is not obfuscated.
What I do wrong or what do I need to do to get successful result?
There are various reasons why exe->il->exe might not work. A few other than the one you mentioned (obfuscated IL), are an executable that also includes native code, or a digitally signed executable that (directly or indirectly) inspects its own signature.
A few debuggers can step through IL without you having to rebuild the application. Personally, I like to use ILSpy for this. Note that the binaries of the latest release don’t include the bits needed for debugging, you need to build it from source for that.
An alternative should be MDbg: Mike Stall reports having added IL stepping to the GUI back in 2005. I have no experience with it.