C# desktop application on express edition. Worked then didn't work 5 seconds later.
I tried the following.
- Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
- Delete all bin and obj folders and all DLLs related to the project from my entire machine.
- Recreate projects causing the problem from scratch.
- Reboot.
I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?
I want to add in here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.
Sometimes, even though it gives you this error, the
breakpoint
still gets hit, so just ignore the error. This happens fairly often in theViews
of anMVC web app
.Webapplications (IIS Express) only:
Check if your .pbd file is missing in your bin/Debug folder. If it is then go to "Properties" of your project, selected "Build" and then "Advanced" at the bottom. Choose "full" under "Debug info" in the new window that appeared. This was my issue and solved it for me.
Things to check just to be clear: Make sure you have the configuration set to 'Debug' and not 'Release'. You can debug the startup project in 'Release' mode, but not a referenced class library.
I have read carefully all the answers above, but none of them solved my problem.
In my case, I was compiling a class library (DLL). No modules seem to be loaded in Debug -> Modules, so I couldn't even load the symbols manually.
My solution was to add this line to my code:
Once this code is reached, an exception is triggered and .NET Framework shows a dialog box asking which Visual Studio (i.e. new instance of VS 2008, new instance of VS 2013, etc) you want to use to debug the program. You can choose the existing instance of VS with your project loaded. This will attach the process to your VS session and load all symbols, and now you can debug your project.
Of course, the compilation has to be done using the Debug configuration, not Release.
Debug
>Windows
>Modules
to see what modules were being loaded put me in the right direction.In my case IIS Express seemed to be loading a different DLL from the temporary ASP.NET files.
The solution?
C:\Users\<YOUR USER>\AppData\Local\Temp\Temporary ASP.NET Files\vs