开发者

Visual Studio attach to process and view the code on break?

I must not have some configuration proper开发者_运维百科ty set correctly...

Basically when I run the app as a service via srvany.exe, it starts, but a class doesn't get instantiated correctly. I've put in a 60 second delay to allow me to attach to the process, but I can't get that exe to break when it hits the break I set in the debugger (I guess that doesn't get compiled in?), and all I can view is the disassembler. Is it possible to do more?


Sounds like VS may be assuming that SrvAny is stricly native code. When you attach to it, make sure that the "Attach to" box contains "Managed code" as a selection. Also, watch the debugger attaching to the process in the output window and make sure that it says "Symbols loaded" when your assemblies are loaded (indicating that the PDB file was found successfully)


Instead of inserting delays and rushing to attach to the process in time, you can call

System.Diagnostics.Debugger.Break();

to break execution and attach the debugger programmatically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜