FatalExecutionEngineError when RegisterAllAreas called

1

I have encountered the following error when starting a debugging 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.'

The error occurs on a asp.net web application built on .net framework 4.7.1 when AreaRegistration.RegisterAllAreas() is called but only on every second debugging session. As far as I known, the error started to occur after we introduced a reference to netstandard. After stopping and starting a new debugging session, everything works fine until the next debugging session.

We are using Visual Studio 2017

c#
asp.net
debugging
visual-studio-2017
.net-4.7.1
asked on Stack Overflow Oct 9, 2019 by Pietro

1 Answer

1

After some googling I found the solution. The issue is caused by bug in .Net Framework.

Editing C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config and inserting disableNativeImageLoad element solved the issue.

<runtime>
  <disableNativeImageLoad>
     <assemblyIdentity name="netstandard" />
   </disableNativeImageLoad>
</runtime>
answered on Stack Overflow Oct 10, 2019 by Pietro

User contributions licensed under CC BY-SA 3.0