c# - 调用 RegisterAllAreas 时出现 FatalExecutionEngineError

标签 c# asp.net debugging visual-studio-2017 .net-4.7.1

我在启动调试 session 时遇到以下错误:

Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x6a1cb403, on thread 0xc88. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.'

当调用 AreaRegistration.RegisterAllAreas() 时,在 .net Framework 4.7.1 上构建的 asp.net Web 应用程序上会发生错误,但仅在每隔一个调试 session 时发生一次。据我所知,该错误是在我们引入对 netstandard 的引用后开始出现的。停止并启动新的调试 session 后,一切正常,直到下一个调试 session 。

我们正在使用 Visual Studio 2017

最佳答案

经过一番谷歌搜索后,我发现了 solution 。该问题是由 .Net Framework 中的错误引起的。

编辑 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config 并插入disableNativeImageLoad元素解决了该问题。

<runtime>
  <disableNativeImageLoad>
     <assemblyIdentity name="netstandard" />
   </disableNativeImageLoad>
</runtime>

关于c# - 调用 RegisterAllAreas 时出现 FatalExecutionEngineError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58305604/

相关文章:

c# - 在 C# 中的每个面向对象的接口(interface)上重新定义相同的枚举

c# - 对齐 GridView 中的行值

c# - 如何更改 |DataDirectory| 的位置在 C# 中构建的 ASP.NET 应用程序中

c++ - 在 Visual Studio 2010 C++ 中查找线程的起始位置

debugging - 错误 :Execution failed for task ':app:dexDebug'

c# - 在 WP8.1 中缩放图像

c# - 带有.net的Web服务无法连接到互联网信息服务中的mysql数据库

c# - 从字符串中获取 HTML 标签

c# - asp.net 中第三层(数据访问层)的 Db Manager 类

c++ - 如何在gdb的调用命令中使用C++默认参数