question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function returned by Microsoft.FSharp.Reflection.FSharpValue.PreComputeUnionConstructor throwing FatalExecutionEngineError when invoked

See original GitHub issue

The function returned by Microsoft.FSharp.Reflection.FSharpValue.PreComputeUnionConstructor is throwing the following error very occasionally when used to create a value of type float option via reflection.

FatalExecutionEngineError occurred Message: Managed Debugging Assistant ‘FatalExecutionEngineError’ has detected a problem in ‘C:\dev\vs2015\src\repro\bin\Debug\repro.exe’. Additional information: The runtime has encountered a fatal error. The address of the error was at 0xf582d7f4, on thread 0xdaa0. 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.

This seems to have started happening after I installed VS2015, however targeting earlier versions of either FSharp.Core or the .NET runtime makes no difference. I’ve also tried setting <useLegacyJit enabled="1"/> in the app.config due to the known bug in RyuJIT (http://nickcraver.com/blog/2015/07/27/why-you-should-wait-on-dotnet-46/), however this also makes no difference. I’ve only tried this on Windows 7, so I don’t know if it’s OS specific. It happens in both Debug and Release build.

I’ve managed to create a reproduction of the error. Compile and run the project linked to below with the conditional compilation symbol ‘BUG’ defined, and it should fail with the above error. Then compile and run without ‘BUG’ defined to replace the use of FSharpValue.PreComputeUnionConstructor with equivalent non reflection based code, and the program will complete without error.

The project can be downloaded from here: https://www.dropbox.com/l/BXokpag4b4pFtBzeTJpion Note that it’s a 20Mb file as it contains 2 embedded data files which contain serialised arrays that trigger the error.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
leecowcommented, Dec 1, 2015

Hi @bmenees , yes, the fix is in yesterday’s 4.6.1 release.

0reactions
meneescommented, Dec 1, 2015

@leecow, is this fix in .NET 4.6.1 (since it was released on November 30)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hotfix rollup 3120241 for the .NET Framework 4.6 and ...
FSharp.Reflection.FSharpValue.PreComputeUnionConstructor throwing FatalExecutionEngineError when invoked. This issue is also fixed in the .NET Framework 4.6.1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found