gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 03:03:33 26 4
gpt4 key购买 nike

假设我们有示例代码(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);
}

现在“特征”: enter image description here

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

现在我知道它只发生在 VS2015 中,并且导致此行为的原因是测试方法中的最后一个字符串。

最佳答案

请在 TOOLS->Options->Debugging 下启用“Use Managed Compatibility Mode”,然后重新调试您的应用程序,我认为您会在调试器窗口中得到与 VS2013 或 VS2017 一样的正确结果。

enter image description here

更新:

即使我们可以解决这个问题,我也向连接报告报告了这个问题:

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

关于.net - 在 Visual Studio 2015 中调试时值不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44239965/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com