-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
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
- Add breakpoint on
line: 4inVisual Studio 2022. - When breakpoint is hit. Then
Step overbreakpoint. - Then
continuethe application. - Now process should be hanging.
Expected behavior
Not to hang or crash.
Actual behavior
Application
Visual Studio
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

