views:

46

answers:

2
static void Main(string[] args)
{
    List<string> myList = new List<string>() { "A", "B" };
    string myString = "abc";
    int myInt = 42;
    System.Xml.Linq.XElement root = new System.Xml.Linq.XElement("abc");

    Console.WriteLine(myList.First()); //breakpoint on this line
    Console.WriteLine(myString);
    Console.WriteLine(myInt);
    Console.WriteLine(root);
}

When I run the above code on my old dev environment (vs2008, XP, 32-bit), I see:

args        {string[0]}    string[]
+ myList    Count = 2      System.Collections.Generic.List<string>
myString    "abc"          string
myInt       42             int
+ root      <abc />        System.Xml.Linq.XElement

When I run it on my new dev environment (vs2008, Windows7, 64-bit), I see:

args                 {Length=0}            array<System::String^> ^
+ myList             0x000000000254bb60    System::Collections::Generic::List<System::String^>^
myString             "abc"                 System::String^
myInt                42                    int
+ root               0x000000000254be60 { emptySequence=<undefined value> name=0x000000000254bd88 lastAttr=<undefined value> }    System::Xml::Linq::XElement^
+ <>g__initLocal0    0x000000000254bb60    System::Collections::Generic::List<System::String^>^

It seems to me that my new environment's Locals window is speaking C++ to me.

How can I change the Locals window behavior?

+3  A: 

It looks like the debugger is interpreting your PDB as being C++/CLI instead of C# code. The only reason I can think that would happen is if your install is broken. In particular the registry surrounding the expression evaluator choice is incorrect. I think at this point you're stuck with repairing the install.

Additionally you'll probably want to delete the following registry key

HKCU:\Sofware\Microsoft\VisualStudio\9.0
JaredPar
I'll give it a shot but can't for a while - I don't have the disk in hand and won't delete registry keys during working hours...
David B
@David B, instead of deleting reg keys you could also just rename it and if it fails rename it back.
JaredPar
Renaming the key (and picking c# dev settings on start up) did not resolve the issue.
David B
@David B, then it sounds like a repair is probably needed (likely the HKLM key is invalid).
JaredPar
A: 

I resolved my issue by unchecking the option to "Run this program in compatibility mode".

David B