In Visual Studio, can I put breakpoints in code for which I only have debugging symbols?
Since I do not have access to the complete source code of a library I'm using, but I do have the pdb files, is it possible to set a breakpoint in the "debuggi开发者_运维知识库ng source code"?
If so, how would I do that?
Yes, this is possible, you don't need the source code. Debug > New Breakpoint > Break at Function. Set the location to the name of the function. For example: "Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly". Turn the "Use Intellisense" checkbox off, you won't have any. Language is a guess if you don't know what it was written in, choose "Unknown" if you're not sure.
You'll want to keep an eye on the Debug + Windows + Breakpoints window to verify that the debugger could resolve the breakpoint. It won't be able to until the assembly gets loaded and the method gets JIT compiled.
This is of course not the greatest debugging experience. Once the breakpoint hits, you don't have anything to look at but the machine code generated by the JIT compiler. And the Call Stack window, your ultimate resource to see method names btw.
精彩评论