25

I've got a strange problem with some C# library and console projects (but not ones I create from scratch) where they are displaying the watches and the smart tags for debugging using C++/CLI notation (for example, showing System::Object^ where I would expect System.Object):

C++ debug smart tag

I've tried changing the project guids, as I thought this was the problem (and some had changed), deleting obj/debug folders, restarting Visual Studio 2010, repairing Visual Studio 2010 and even the old favourite restarting Windows.

Is there any obvious setting I'm missing that has somehow been enabled?

Chris S
  • 64,770
  • 52
  • 221
  • 239
  • Are you starting the process to be debugged through Visual Studio, or are you attaching to an existing process? Which debuggers do you have enabled? – M.Babcock Mar 28 '12 at 15:25
  • Have you tried playing with Just my code and Mixed Mode debugger settings? – GregC Mar 28 '12 at 15:26
  • Is it so small that you can make a procdump -ma and show it to us? – GregC Mar 28 '12 at 15:26
  • @M.Babcock I'm using a console application as one project (using a VS host), and also attaching to IIS/w3p.exe in another separate project. – Chris S Mar 28 '12 at 15:29
  • 6
    https://connect.microsoft.com/VisualStudio/feedback/details/540228/visual-studio-debugging-c-as-c – jrummell Mar 28 '12 at 17:37
  • 2
    I saw a similar question not too long ago, but now I can't find it. – jrummell Mar 28 '12 at 17:40
  • @Ed c++ is a language not a framework but no, rest sharp is a c# project; they're all created on my machine and not dlls – Chris S Mar 28 '12 at 23:03
  • 4
    @ChrisS: I know what C++ is. This is not C++; `SomeType^`. CLI is a modification to the language, it is its own language based on C++. – Ed S. Mar 28 '12 at 23:07
  • @EdS. How would you describe the title? Managed C++ ? I think you're being a little bit of a pedant :) The syntax is still very much C++ albeit made CLI compliant – Chris S Mar 29 '12 at 17:50
  • 3
    Pedantry is often required on programming.... being specific matters. – Ed S. Mar 29 '12 at 18:00
  • @EdS. right, but navel gazing aside it doesn't make any difference to my problem whether it's managed C++ or not, as they're c# projects being debugged – Chris S Mar 29 '12 at 18:15
  • 2
    Well, it does if you are using CLI and that is why you are seeing these objects (which was my original question). Either way it doesn't matter at this point, but I have a hard time troubleshooting a problem when given relatively vague information and I am a stickler for accuracy. Calling CLI C++ just feels very wrong to me :) – Ed S. Mar 29 '12 at 18:26
  • @Chris Correct question titles and tags are the key to gettig correct answers. You wouldn't tag this question `python` either, as it doesn't have anything to do with that language. Seeing a connection between C++ and C++/CLI where there is none is the best source for errors. – Christian Rau Mar 29 '12 at 19:16
  • 1
    possible duplicate of [Visual Studio 2010 SP1 c# has c++ syntax](http://stackoverflow.com/questions/9569670/visual-studio-2010-sp1-c-sharp-has-c-syntax) – Ben Voigt Mar 29 '12 at 21:35
  • @ChristianRau It appears I attracted + insulted C++ purists too – Chris S Mar 30 '12 at 12:22
  • @ChrisS No, it wasn't meant that way. It may be that you are perfectly aware of the differences, but many aren't, therefore the words of warning. Those that aren't aware of the differences don't insult C++ purist, but cause an extrordinary amount of stupid errors and then wonder why some "Visual C++" code doesn't work the way its expected. – Christian Rau Mar 30 '12 at 17:26
  • @ChristianRau I didn't actually know managed C++ had drifted so far apart, I haven't used it for 7 years – Chris S Mar 30 '12 at 22:19
  • I discovered that loading reverting to an old, already compiled version of my code fixed this issue, so long as I didn't delete to bin and obj directories. I suspect this means that, at least in some cases, the problem is in the way Visual Studio is generating DLLs/PDBs, rather than with the way it is debugging them. – Brian Sep 12 '12 at 14:10

2 Answers2

4

I ran into this issue as well, the debugger picked up c# and c++ in all c# projects. I'm running windows 7 64 bit.

I resolved this issue by going to the compatibility tab of the properties of the shortcut. It was checked as running as windows xp service pack 3. I unchecked that and still kept run as administrator checked. Suddenly my debugger picked all of it up as c# again.

Dan Weaver
  • 101
  • 1
  • 2
2

As this link in the comment provides an answer from Microsoft - "Cannot reproduce" I had to uninstall Visual Studio 2010 and re-install it (in fact I re-imaged my machine).

Switching off the "HEX" option shown here did turn off hex addresses, but not the C++/CLI display.

Community
  • 1
  • 1
Chris S
  • 64,770
  • 52
  • 221
  • 239