本文介绍了Viisual Studio 2015在更新后没有找到范围内的变量2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET核心项目和一个Xunit项目在一个解决方案,我突然遇到了巨大的调试问题。这似乎与昨天安装更新2一致。



当调试和点击断点时,只有几个参数显示在本地,汽车,手表或可从即时窗口。我想,但是还没有验证100%,我可以访问的变量是全局变量,而作为参数传递给函数。



例如,这个测试:

  public void UniTest4()
{
var s = @{
id:0001,

type:donut,
name:Cake b $ bppu:0.55,
batters:
{
面糊:
[
{id :1001,类型:常规},
{id:1002类型 ,
{id:1003,类型:蓝莓},
{id:1004,类型:魔鬼的食物}
]
},
topping:
[
{id:5001,type:无},
{ :5002,type:Glazed},
{id:5005,type:糖 ,
{id:5007,type:粉糖},
{id:5006, type:Chocolate with Sprinkles},
{id:5003,type:Chocolate},
{ id:5004,type:Maple}
]
};

var token = yayson.MakeToken(s);

当我打破最后一行时,我无法访问变量s。我已经找到类似问题的其他人,然后看到建议,这可能是由于建立与某些编译器优化。但是真的是这样吗?下面显示了我的Xunit项目的构建设置。我的商业项目看起来是一样的,擅长顶级复选框被检查(它也是在VS更新之前工作得很好)。





再次找到本地变量可以做些什么?

解决方案

我终于通过这个SO问题找到了Andrew Arnott的解决方案:



只需勾选使用管理兼容性模式盒子解决了我的问题。虽然我很想知道为什么这有帮助。


I have a .NET core project and an Xunit project in a solution, where I've all of a sudden gotten huge problems with debugging. This seems to have coincided with installing update 2 yesterday.

When debugging and hitting a breakpoint, only a select few parameters show up in locals, autos, watch or are reachable from immediate window. I think, but haven't verified 100%, that the variables I can access are globals and ones passed as parameters to the function.

For instance, look at part of this test:

 public void UniTest4()
        {
            var s = @"{
                ""id"": ""0001"",

                ""type"": ""donut"",
                ""name"": ""Cake"",
                ""ppu"": 0.55,
                ""batters"":
                    {
                            ""batter"":
                            [
                                { ""id"": ""1001"", ""type"": ""Regular"" },
                                { ""id"": ""1002"", ""type"": ""Chocolate"" },
                                { ""id"": ""1003"", ""type"": ""Blueberry"" },
                                { ""id"": ""1004"", ""type"": ""Devil's Food"" }
                            ]
                    },
                ""topping"":
                    [
                        { ""id"": ""5001"", ""type"": ""None"" },
                        { ""id"": ""5002"", ""type"": ""Glazed"" },
                        { ""id"": ""5005"", ""type"": ""Sugar"" },
                        { ""id"": ""5007"", ""type"": ""Powdered Sugar"" },
                        { ""id"": ""5006"", ""type"": ""Chocolate with Sprinkles"" },
                        { ""id"": ""5003"", ""type"": ""Chocolate"" },
                        { ""id"": ""5004"", ""type"": ""Maple"" }
                    ]
            }";

            var token = yayson.MakeToken(s);

When I break on the last line, I can't to reach the variable "s". I have looked for others with similar problems, and have then seen suggestions that this may be due to building with certain compiler optimizations. But is that really the case for me? Shown below are the build settings for my Xunit project. My business project looks the same, excep for the top checkbox being checked (which it also was, working just fine, prior to the VS update).

What can I do to find local variables again?

解决方案

I finally found a solution from Andrew Arnott via this SO question: Visual Studio 2015 Debugging: Can't expand local variables?

Just ticking the "Use Managed Compatibility Mode" box solved my problem. Although I'd love to know why that helped.

这篇关于Viisual Studio 2015在更新后没有找到范围内的变量2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 23:38