我在启动调试 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/