visual studio debugging c# as c++ - by imjatse

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 540228 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 3/8/2010 7:03:09 PM
Access Restriction Public


I know this sounds like a put on, but I assure you its happening.  My Visual Studio 2008 Professional SP1 is debugging c# dlls as c++.  This means that most of the normal debugging is disabled, Watch, Immediate and Locals are all displaying as c++ style memory 0x00.. type names.  The modules windows correctly shows the symbols loaded from the correct location, and the debugger is bound to the correct dll.  The stack trace window calls the language c++ and the stack trace class names are in the c++ format.  It all started one day, with no changes made to the machine so far as I know.  This is a server 2008 r2 laptop running sql server 2008 and SharePoint 2007, used for coding against SharePoint.  C++ is not installed as part of Visual Studio and the code is, very certainly, not c++.

I would love if I have foolishly checked some box in the settings but I have reset them, reinstalled VS multiple times, and used the VS uninstall tool.  I even removed all the settings from the registry to ensure nothing was left between installs.  I am stumped and any help would be appreciated.  I could wipe the machine, but we are in the middle of a large coding push so this isn't the best time for that.

I can supply any additional information requested.

Sign in to post a comment.
Posted by crokusek2 on 11/25/2011 at 8:12 PM

I am having the same problem. The only thing that I recall changing recently was modifying some result windows to display in hex and then changed them back. Seems unlikely related but thought I would mention it.

All projects/solutions that are "MS Visual C#" now behave this way in the debugger. However the Visual Web Developer did still stay in C# mode. The Immediate window does not prompt anymore and I can't always use C# expressions within there. I have to use m_count instead of Count for instance if able to figure out the equivalent.

Visual Studio 2008 Standard Edition V9.0.21022.8, .NET 3.5 SP1.

Would it possible to get an upgrade or refund for something unfixable like this?

Posted by Andrew [MSFT] on 3/24/2010 at 9:58 AM
Our apologies that we are unable to solve your problem.

One thing that would be interesting to try (if possible) would be to copy the executables and pdb's built on a machine where everything is working correctly. Open the .exe file as a project (with the pdbs placed next to the binaries) and begin debugging that way. Assuming you have exactly matching source code to what was built, you can manually open the files and set breakpoints. If this works, it means that the issue is with the part of the .NET framework that writes the pdb's when you build (the compiler uses the .NET framework to create the pdb's, which include headers specifying the language). If this works, that is where the problem is.

If that does not work, the issue could still be with the part of the .NET framework that reads the pdb's or it could be some other registration messed up in your registry that we haven't been able to find. As I previously indicated, the issue is that your machine is choosing the wrong expression evaluator, but since you are able to hit breakpoints, you are using the correct debug engine (managed).
Posted by imjatse on 3/24/2010 at 6:11 AM
Just to follow up for anyone happening upon this ticket, there was no resolution. None of the suggested fixes actually fixed, what I admit is, a very strange and random issue. Good luck!
Posted by Andrew [MSFT] on 3/23/2010 at 5:29 PM

No I did not intend you to set the path to "*\cscompee.dll", it should be the full path of "C:\...\cscompee.dll".

When you uninstalled Visual Studio, did you try deleting all of the "Visual Studio" registry hives, and then doing a Repair of the .NET Frameowork before re-installing Visual Studio? If not, you may try that.

Best Regards,
Visual Studio Debugger
Posted by imjatse on 3/19/2010 at 6:52 AM
Yes, that was set to a full path c:\....\cscompee.dll which I verified was correct. I also tried changing it to be "*\cscompee.dll" since I wasn't sure if that was what you wanted. No luck.
Posted by Andrew [MSFT] on 3/17/2010 at 11:06 AM
One more thing to try, look at the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\CLSID\{60F5556F-7EBC-4992-8E83-E9B49187FDE3}. InprocServer32 should be pointing to *\cscompee.dll
Posted by imjatse on 3/17/2010 at 7:33 AM
I had previously uninstalled all of the frameworks and reinstalled. I tried a repair yesterday but it didn't help. I also tried removing the 3.5.1 Once I am done with this project I'll just reformat and start over, maybe that will fix it. Rather inconvenient, but so it goes I guess. Thanks for your help.
Posted by Andrew [MSFT] on 3/15/2010 at 1:44 PM
Thanks, the registry contents looked normal, please try do a repair of the .NET framework and see if that solves the issue?
Posted by imjatse on 3/15/2010 at 6:29 AM
All set, let me know if there is anything else you need. Thanks!
Posted by Andrew [MSFT] on 3/12/2010 at 4:11 PM
One more request. Could you reproduce this issue, and then attach a screen shot of what the Processes Window shows (Debug -> Windows -> Processes) while you are stopped at a breakpoint?
Posted by Andrew [MSFT] on 3/12/2010 at 4:01 PM
would it be possible for you to export the values under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\AD7Metrics\ExpressionEvaluator to a .reg file and upload that for us to inspect?

Your application is being debugged with the correct debug engine or you would not be able to step or hit breakpoints, but the wrong Expression Evaluator is being used (Managed C++ instead of C#) why is why you can't inspect anything in the watch window.
Posted by imjatse on 3/12/2010 at 2:12 PM
I have attached a file attachtoprocess.png that is the pop-up. Managed code is displayed. I blacked out the computer name and user names but everything is local on this machine, no remote debugging. So far as I know I am doing nothing differently than the 1000's of other times I've attached to a process. I have it set to Automatically determine the type of code, but managed code is an option, see attachtoprocess2.png.

Yes, I do have the registry key in the x64 location exactly as specified. It has many sub values and one sub key "AutoSelectIncompatibleList".

Posted by Andrew [MSFT] on 3/11/2010 at 5:17 PM
If you open the "Attach to Process" dialogue, and click the "Select" button for the "Attach to:" box, is "Managed" an option under the "Debug these code types:"?

If you open "regedit" and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine (for an x64 OS it will be HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\AD7Metrics\Engine) is there a key present named: {449EC4CC-30D2-4032-9256-EE18EB41B62B}?
Posted by imjatse on 3/11/2010 at 11:41 AM
The file extension is cs, aspx.cs, or ascx.cs. A files were created in the normal right click Add -> new item way; by which I mean to say not generated.

For debugging this happens if I hit F5 in a console app, bind to the w3wp.exe process (through the debug->attach to process menu) or right click debug -> start new instance on a console application.

This behavior is also global across all projects running on my computer. The same code on a different developer's laptop is debuggable as expected. All code is stored in TFS so we are definately working with the same files/extensions/project properties.

Thanks for taking a look and please let me know if there is anything else I can do to help on my end.
Posted by Andrew [MSFT] on 3/11/2010 at 11:31 AM

A few questions to help diagnose this issue:
-What are the file extensions for the source code that you are debugging?
-How are you debugging? Meaning:
--Are you attaching to a process?
--Are you pressing F5?

Visual Studio Debugger

Posted by imjatse on 3/9/2010 at 7:15 AM
I have added a screen shot showing what I see when debugging. It hits the breakpoint properly but the windows seem to all think the code is c++. Also, if I try and use the watch window I get the error seen in debug2.png.
Posted by Microsoft on 3/9/2010 at 1:01 AM
Thank you for reporting this issue. But we're unable to reproduce this issue. Could you please provide us with some screenshots and more concrete repro steps for this issue?