No symbols have been loaded and pdb file missing

淺唱寂寞╮ 提交于 2020-01-13 16:29:51

问题


I'm trying to understand why I get the "The breakpoint will not currently be hit. No symbols have been loaded for this document" message, when try to debug my web site application (note: no web application, in case it matters)

So far I found out that the pdb (project debug database) file is as important as the source code, and it should appear in the bin folder, but for whatever reason the file is missing, just some dll's are placed there, actually there is no pdb file in the entire directory.

My first question is: There should be a pdb file regardless whatever the kind of project that is being developing. Correct?

Second question: How can I re-create that file again, or what steps needs to be done in order to debug the project again?


回答1:


Couple of things I do to try to correct this problem:

  • Clear the temporary ASP.NET files (C:\Windows\Microsoft .NET\Framework{version}\Temporary ASP.NET files{site} (You will need to quit Visual Studio and any web browsers pointing to the development site)
  • Start Task Manager and right click the W3WP.EXE process, select SET AFFINITY and uncheck all but one CPU

Usually if I do this, then attach to the W3WP process to debug, the breakpoint will be filled in and I can step through my code.




回答2:


You have to have compilable code to get the pdb. It sounds like you do.

Usually what is happening is that you have setup your build to be "Release" instead of "Debug".

http://msdn.microsoft.com/en-us/library/wx0123s5.aspx

If you are creating a web application, your configuration files might also have a "Retail" setting. If set to true, you are always in "Release" mode, even if it says otherwise in your build configuration.

http://msdn.microsoft.com/en-us/library/ms228298(v=vs.80).aspx




回答3:


I just had this problem, and it turns out my web.config was set to debug=false.
Make sure that compilation debug=true in your web.config

<compilation defaultLanguage="vb" debug="true" batch="false" targetFramework="4.0">
  <assemblies>
    <!-- add references to gac assemblies here-->
  </assemblies>
</compilation>



回答4:


To generate .pdb files in Release, you need to set your project's properties:

Compile\Advanced Compile Options\Generate Debug Info => 'pdb-only' or 'Full'

Package/Publish Web\Exclude generated debug symbols => untick this




回答5:


In my quest for a solution to my problem I found this:

First, like Adrian Iftode said, in the Web site case, the code behind files are compiled by ASP .Net, not by the VS, so there are no dll and pdb files in bin folder.

  • So I delete all temporary files from: windows\Microsoft .NET\Framework\v2.0.50727\Temporary ASP.NET files\

which contains a folder for every project you have.

  • Delete all temporary files from iexplorer
  • In IIS properties for the project\Directory\Configuration\Debugging\ check both options below Debugging flags.

By doing all the above, I was able to debug my website again.




回答6:


Further to Resource's answer above, even though I am running debug versions, I had to set the Release version of the project to debug (in my case a NuGet package) to 'pdbonly' as well. I'm also using MyGet as a symbol server, but doing this I can also debug using local versions. I have the following setup:

Release versions uploaded to MyGet NuGet package server Debug versions uploaded to MyGet Symbol server



来源:https://stackoverflow.com/questions/8948290/no-symbols-have-been-loaded-and-pdb-file-missing

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