Mason Wheeler
Mason Wheeler

Reputation: 84640

How do I make ReSharper Ultimate decompile stack frames?

I know that ReSharper Ultimate puts an add-in into Visual Studio that can decompile external code, because I've blundered into decompilations of various things a few times before without meaning to. But now I'm in a situation where that would actually be useful, and I can't actually get the decompiled view to show up.

I'm debugging a Visual Studio extension, and I've run into an operation where attempting to instantiate the form designer causes a NullReferenceException dozens of stack frames (and multiple Managed To Native Transition roundtrips) beyond the last call from my code. I can load symbols and examine the call stack in the debugger, and it appears to be blowing up on something related to name resolution, but the name is the name of a type in the framework, not my own code, so I have no idea what's going on or how to fix it.

It would sure be nice to be able to use this decompiling feature that I know I have available to look under the hood of this function and figure out what's going wrong, but no matter what menus I look through I can't figure out how to get it to give me a decompile of an external stack frame.

Does anyone know how to do this?

Upvotes: 3

Views: 410

Answers (1)

citizenmatt
citizenmatt

Reputation: 18583

ReSharper won't decompile from the call stack window. I guess the big reason is that you wouldn't be able to debug that code, or set breakpoints, because it's just decompiled code, and doesn't contain debug information. And I think if it did decompile from the call stack window, you'd expect debugging to work, too.

Instead, what you can do is use dotPeek to act as a symbol server. It will start a HTTP server and listen to requests for debug files for assemblies. If it has the assembly loaded, it will decompile it, generate a .pdb file and serve it to Visual Studio. You'll then be able to double click on frames in the call stack, and navigate to the source that has just been decompiled.

You can read more about it in the documentation.

Upvotes: 3

Related Questions