runtime: Environment.FailFast is reported as ExecutionEngineException

Description

However, according to the docs, this one is no longer being raised

Reproduction Steps

Run the following (This reproduces without running under the debugger):

Variant 1:

Environment.FailFast("Testing");

Variant 2:

using System.Runtime.InteropServices;

var sectionBytes = new byte[2912012];
var funcAddr = 1828651008u;
Marshal.Copy(sectionBytes, 0, (IntPtr)funcAddr, sectionBytes.Length);

Expected behavior

There is a reported usage of Environment.FailFast

Actual behavior

An unhandled ExecutionEngineException is reported.

Regression?

No response

Known Workarounds

No response

Configuration

.NET 7.0.100-alpha.1.21568.2 OS: Windows 10 Pro Version 21H1 (Build 19043.1415) Architecture: AMD64

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 33 (30 by maintainers)

Most upvoted comments

So the issue is a confused debugger?

This is a result of bad interaction between Visual Studio and the runtime- there is no exception, but the UI makes it look like there is. Prior reporting relied on MDAs (Managed Debugging Assistants), but we do not plan on bringing them back. We will reconsider fixing this issue in a future release.

Hmm, actually, the issue is not due to the address not being in the null reference detection area. The failure with size=2049 happens at address 0x20, so it should have been reported as null reference. I’ll investigate it further.