在VS2008的本地窗口中出现奇怪的结果

时间:2010-09-28 18:31:33

标签: c# visual-studio visual-studio-2008 locals

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);
}

当我在旧的开发环境(vs2008,XP,32位)上运行上面的代码时,我看到了:

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

当我在新的开发环境(vs2008,Windows7,64位)上运行它时,我看到了:

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^>^

在我看来,我的新环境的Locals窗口正在向我讲C ++。

如何更改“本地”窗口行为?

2 个答案:

答案 0 :(得分:3)

看起来调试器将您的PDB解释为C ++ / CLI而不是C#代码。我认为会发生这种情况的唯一原因是你的安装是否被破坏。特别是围绕表达式求值程序选择的注册表是不正确的。我想在这一点上你仍然坚持修复安装。

此外,您可能还想删除以下注册表项

HKCU:\Sofware\Microsoft\VisualStudio\9.0

答案 1 :(得分:0)

我通过取消选中“以兼容模式运行此程序”选项解决了我的问题。

相关问题