繁体   English   中英

在Visual Studio 2015中调试时值不正确

[英]Incorrect value while debugging in Visual Studio 2015

假设我们有示例代码(VS2015,WinForms,.Net 4.6.1):

List<int> items = new List<int>();
private async Task test(int id)
{
    id = 1;
    int id_real = id;

    int index = items.FindIndex(x => x == id);
}

private async void button1_Click(object sender, EventArgs e)
{
    await test(0);
}

现在“特色”: 在此输入图像描述

怎么可能? 有趣的部分 - 它只是Visual Studio观察者问题,运行时结果仍然正确。

现在我知道它只发生在VS2015中,并导致这种行为 - 测试方法中的最后一个字符串。

请在TOOLS-> Options-> Debugging下启用“使用托管兼容模式”,然后重新调试您的应用程序,我认为您将在VS2013或VS2017的调试器窗口中获得正确的结果。

在此输入图像描述

更新:

即使我们可以解决此问题,我也将此问题报告给连接报告:

https://connect.microsoft.com/VisualStudio/feedbackdetail/view/3135000/incorrect-value-while-debugging-in-visual-studio-2015

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM