Visual Studio 2019:出现错误弹出窗口:“为了防止在评估函数时发生不安全的中止..." [英] Visual Studio 2019: Error pop-up appears: "To prevent an unsafe abort when evaluating the function..."

查看:263
本文介绍了Visual Studio 2019:出现错误弹出窗口:“为了防止在评估函数时发生不安全的中止..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在启动 ASP.NET Core 3 WebApi 项目时遇到了 Visual Studio 2019(版本 16.3.8)的问题.

I am facing an issue with Visual Studio 2019 (version 16.3.8), when starting an ASP.NET Core 3 WebApi project.

点击确定后,项目启动并运行,没有任何问题.然而,每次我开始我的解决方案时,弹出窗口总是唠叨我.

After clicking OK the project starts and runs without any issue. However the pop-up keeps nagging me every time I start my solution.

  1. 我怎样才能停止显示它?
  2. 它到底想告诉我什么?

推荐答案

似乎有两种可能的解决方案,至少对我使用 Visual Studio 2019 有用.

There seems to be two possible solutions to this, that at least worked for me being on Visual Studio 2019.

解决方案

转到<代码>工具=>选项 =>调试 =>通用,然后启用使用托管兼容模式(感谢Nan Yu)或禁用启用属性评估和其他隐式函数调用.

Goto Tools => Options => Debugging => General and then either enable Use Managed Compatibility Mode (thanks to Nan Yu) or disable Enable property evaluation and other implicit function calls.

第二种解决方案面临的缺点是,当处于中断模式时,我们必须在本地窗口上手动点击刷新才能查看变量内容.

The second solution faces the drawback that when being in break mode, we have to manually hit refresh on the locals window to see a variables content.

背景

该消息告诉我们,由于隐式属性评估,我们的系统状态可能会在处于中断模式时发生更改.

The message is telling us, that our system state may get changed when being in break mode due to implicit property evalution.

默认情况下,我们告诉 Visual Studio 调试器尝试隐式评估属性.这当然需要在我们刹车时运行代码,而不仅仅是显示内存内容.运行代码,可能会改变系统的状态,这并不总是我们想要的.例如,我可能会在每次访问该属性时增加一个计数器,这意味着当调试器尝试评估属性时,我的代码将运行,计数器会增加,我的系统状态会改变,即使我刹车了.

By default, we tell Visual Studio debugger to try and evaluate properties implicitly. This of course requires running code while we are braked, and not only display memory content. Running code, might potentially change the state of the system, which is not always what we want. For example, I might be increasing a counter every time the property is accessed, which means that when the debugger will try to evaluate the property, my code will run, the counter will be incremented, and my system state is changed, even though I am braked.

https://blogs.msdn.microsoft.com/eliofek/2012/12/12/why-do-we-get-the-function-evaluation-requires-all-threads-to-运行/

这篇关于Visual Studio 2019:出现错误弹出窗口:“为了防止在评估函数时发生不安全的中止..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆