debugging windows service gives No symbols have been loaded message

三世轮回 提交于 2019-12-09 13:46:11

问题


I have a Windows service and I have written Debugger.Attach() in the Onstart method of the service. When I start the service I get a popup which asks to select the debugger instance. When I select and press ok, the visual studio comes into focus but shows me "No symbols have been loaded" message.


回答1:


I followed two steps 1.from here http://geekswithblogs.net/dbutscher/archive/2007/06/26/113472.aspx

While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project. Look for your project's DLL, and check the Symbol Status for it. If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.

2 goto Debug-> options and settings -> under the debugging node -> general ...uncheck "just my code" checkbox

and it worked...




回答2:


I most commonly see this issue when the build of my project that is running doesn't exactly match the build currently loaded in VS. For example, I build my VS project, then I make some (any) change to a file in the project and save without rebuilding. Then if I run the executable/service/DLL the previously built version will run and since it doesn't match the version I have in VS (thanks to my code change), it won't properly attach.

The specific issue in this case is that the VS debugging PDB file does not match the source code making debugging impossible.

This may not be your issue, but I have seen the "no symbols..." error countless times and it is usually a case of the code being executed not matching the code in VS.



来源:https://stackoverflow.com/questions/4957720/debugging-windows-service-gives-no-symbols-have-been-loaded-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!