Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug a .NET executable at MSIL-level?

I have a .NET executable file that I need to debug. I would like to step into it so that it stops on the first instruction and have a visual interface for single-stepping, breakpoints, etc.

This seems like it should be easier but I haven't yet found a solution! I read about DbgCLR.exe on the web but I can't find that file on my system or online for the life of me. I also read somewhere that DbgCLR.exe is no longer necessary because Visual Studio can do the same thing. A Visual Studio .NET solution would be great, too! (Maybe there's a menu item that I overlooked?)

Either will suit, so long as I can inspect the stack, set breakpoints, etc.

like image 896
Eyal Avatar asked Apr 12 '10 18:04

Eyal


2 Answers

If you're one to buy utilities - Red Gate's new .NET Reflector Pro does exactly that situation really well ($195). I think you can get an evaluation version that last for a little while on Red Gate's site

I've use DILE in the past to do that in IL, for some reason I've had mixed experiences with Deblector.

Probably not worth your time but you can also create pdb symbols for an exe but if the assembly has alot of references it gets complicated. I put a blog post together a few years ago on how to do it: Disassembling .NET - Appendix A

like image 162
Jason Haley Avatar answered Nov 14 '22 23:11

Jason Haley


WinDbg can be used as it automatically stops when the process initiated. However, it only displays native things unless you utilize SOS.dll and managed debugging skills. So it has a sharp learning curve.

like image 24
Lex Li Avatar answered Nov 14 '22 23:11

Lex Li