views:

500

answers:

2

I'm getting this error message on all projects (including brand new empty templates) I'm trying to build with Visual Studio 2008:

Unexpected debug information initialization error -- 'Failed to find a required export in the runtime.'

The Error Help for Compiler Error CS0040 is not very helpful:

This error can occur when using the /debug compiler option and indicates that the compiler was unable to write to the .pdb file. Possible resolutions to this error include reinstalling Visual Studio, ensuring that the compiler has write access to a file or directory, or not compiling with /debug.

I can manually create files in the intended {bin,obj}\Debug directories, running the Studio as Administrator didn't help, uninstalling both the 3.5 framework and the Visual Studio 2008 and re-installed both with their respective Service Packs and I'm still getting the error.

Removing all /debug switches from the command line obviously removes the error message as indicated, but is no option for further development.

How can I further debug this?

A: 

This sounds like you've got mismatched versions of VS/.NET DLLs somehow installed, or some bizarre "half 3.0 half 3.5" bad state that I've seen happen a few times; you could go around checking versions everywhere but it might be easiest to just pave the machine :(

Paul Betts
since that's my primary work'n'play machine I'd rather like to avoid that ...
David Schmitt
A: 

In the end, I used the Process Monitor from the Sysinternals Suite to take a look at the things the compiler was doing. By starting csc.exe from the Visual Studio 2008 Command Prompt and filtering by Process Name is "csc.exe" in the process monitor, I got a good picture of what the compiler was doing.

"Inspired" by the "Failed to find a required export in the runtime" message I searched for missing DLLs and actually found that csc.exe was trying to access Windows\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll but failed. Getting that DLL from another installation fixed the error for me.

David Schmitt