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

发布于 2024-09-25 03:43:05 字数 1412 浏览 6 评论 0原文

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++。

如何更改本地窗口行为?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮光之海 2024-10-02 03:43:05

看起来调试器正在将您的 PDB 解释为 C++/CLI 而不是 C# 代码。我认为会发生这种情况的唯一原因是您的安装损坏。特别是围绕表达式求值器选择的注册表不正确。我认为此时您必须修复安装。

此外,您可能需要删除以下注册表项

HKCU:\Sofware\Microsoft\VisualStudio\9.0

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
烈酒灼喉 2024-10-02 03:43:05

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文