On Sunday morning I found out the Visual Studio 2010 Debugger has stopped working for me. It wasn’t isolated to a single project or technology. Attach to process didn’t work in Silverlight and running Unit Tests in debug mode gave the usual “The breakpoint will not be hit. No symbols have been loaded for this document.”:
Visual Studio was in Debug mode just didn’t pass through any breakpoint (just to check that the Unit Tests used the latest build I added Assert.Fail and the Unit Test failed).
So, first I thought to give myself a challenge and try to work without a debugger. All was of the good until I had a small and stupid bug that I was sure I could just solve using Unit Tests, but the server side worked and I could see the data passing from the client using Fiddler. It didn’t help that in the front of my mind I just knew that with a Debugger this will be solved in minutes. So I dropped the challenge and started investigating the problem.
First I went through the usual suspects:
- Made sure I was building in debug mode (Solution Configuration toolbar –> Debug)
- Deleted the Bin\Debug files and rebuilt
- Changed the Build Platform from “Any CPU” to x86
- Made sure the project build’s debug info was on full (Project properties –> Build –> Advanced… –> Debug Info should be full):
- Restarted the computer
- Enabled Just My Code (Options-> Debugging –> General), since I like having symbol debugging it was turned off
- Reset the setting using Devenv.exe /resetsettings
- I decided against using Devenv.exe /SafeMode (but next time I will use it)
I was very close to trying the repair on the windows Control Panel. But then I noticed that while the debugger didn’t break on any breakpoint it did show a few BadImageFormatException exceptions being thrown, setting Visual Studio to break on those exceptions (Debug menu –> Exceptions… (or Ctrl+D+E) –> Find: “BadImageFormatException” and checking the thrown:
Running it again:
System.BadImageFormatException occurred
Message=Could not load file or assembly 'dbghelp.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Source=mscorlib
FileName=dbghelp.dll
FusionLog=""
StackTrace:
at System.Reflection.AssemblyName.nGetFileInformation(String s)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
InnerException: System.BadImageFormatException
Message=Could not load file or assembly 'dbghelp.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
FileName=dbghelp.dll
FusionLog=""
InnerException:
Or just the Dlls:
- dbghelp.dll
- DDConfig.dll
- LanguagePackage.dll
- Microsoft.VisualStudio.Coverage.Symbols.dll
- Microsoft.VisualStudio.ProgressionIcons.dll
- Microsoft.VisualStudio.QualityTools.RecorderBarBHO100.dll
- pidgenx.dll
- SqlTDiagN.dll
- SqlToolsVSNativeHelpers.dll
- symsrv.dll
Searching the file system for one of them dbghelp.dll,the icon for the DLLs was for dotPeek which got me thinking about uninstalling JetBrains early access tools dotPeek and dotCover (after closing VS) – just to be sure it wasn’t them…
Trying Debug again and everything worked.
The weird part is trying to reinstall those apps (with the exact same MSIs) didn’t reproduce the problem. Looking back I remember restarting my computer before all this started but even restart won’t reproduce the problem.
Another case for the “computer's nondeterministic nature”…
Resources:
Peter Gfader 's .NET Blog: VS2010 - Debugging not working
StackOverflow: debugging is not working in my visual studio 2010