Skip to content

System.ExecutionEngineException occurred in Unknown Module (Fatal error. Internal CLR error. (0x80131506)) #112226

@cschuchardt88

Description

@cschuchardt88

Description

When debugging (stepping over) from managed code to unsafe code, then clicking continue in Visual Studio 2022. The application you are debugging crashes dotnet. Ends up hanging dotnet application when you resume it when debugger is attached.

Reproduction Steps

  1. Add breakpoint on line: 4 in Visual Studio 2022.
  2. When breakpoint is hit. Then Step over breakpoint.
  3. Then continue the application.
  4. Now process should be hanging.

Expected behavior

Not to hang or crash.

Actual behavior

Application

Image

Visual Studio

Image

Regression?

No response

Known Workarounds

No response

Configuration

Code

int max = int.MaxValue;
int min = int.MinValue;
int value1 = min * -1;
int value2 = max + 1;
long value3 = value2; // Add break point here, then step over this point.

unsafe
{
    int* maxPtr = &max;
    int* minPtr = &min;
    int* valuePtr1 = &value1;
    int* valuePtr2 = &value2;

    Console.WriteLine($"int.MinValue = {min}           // Pointer: 0x{(ulong)minPtr:x}");
    Console.WriteLine($"int.MaxValue = {max}            // Pointer: 0x{(ulong)maxPtr:x}");
    Console.WriteLine($"int value1 = {value1}             // Pointer: 0x{(ulong)valuePtr1:x}");
    Console.WriteLine($"int value2 = {value2}             // Pointer: 0x{(ulong)valuePtr2:x}");
    Console.WriteLine($"{min} * -1 = {max}        // Does it equal '{max}'? Result: {value1 == max}");
    Console.WriteLine($"{value1} == {value2}           // Does 'value1' equal 'value2'? Result: {value1 == value2}");
}

*.csproj File

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

</Project>

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions