-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Milestone
Description
Description
Before .NET 10 rc1, if you stop on an unhandled exception, you could continuously unwind that exception and attempt to fix the problem. In the rc1 build, unwinding works only once.
Reproduction Steps
- Create a C# program with the following code
- In Visual Studio, open the exception settings window (Debug->Windows->Exception Settings)
- Click the 'Common Language Runtime Exceptions' category twice so that it shows you the empty box (so that the debugger will not stop when an exception is thrown)
- Run the program under the debugger, which should stop when the null reference exception is unhandled.
- Open the call stack window, right click on the
Program.Main
frame, and invoke 'Unwind Exception to This Frame'. - Continue again
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine(NullString.Length);
}
private static string NullString = null!;
}
Expected behavior
The debugger should break in exactly the same spot as it did the first time
Actual behavior
The debugger breaks with the following stack and the exception cannot be unwound a second time.
[System.NullReferenceException unhandled]
[Exception] CsUnhandledException.dll!Program.Main(string[] args) Line 5
[Managed to Native Transition]
System.Private.CoreLib.dll!System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle mark, string message, System.Runtime.CompilerServices.ObjectHandleOnStack exception, string errorMessage)
System.Private.CoreLib.dll!System.Environment.FailFast(ref System.Threading.StackCrawlMark mark, string message, System.Exception exception, string errorMessage)
System.Private.CoreLib.dll!System.Environment.FailFast(string message)
System.Private.CoreLib.dll!System.AppContext.OnUnhandledException(object e)
[Native to Managed Transition]
CsUnhandledException.dll!Program.Main(string[] args) Line 5
Regression?
Regression from .NET 10 preview 7
Known Workarounds
Restart the target app
Configuration
I tested .NET 10 rc1 on Windows. The problem reproduces for both x86 and x64. I didn't try any other configurations.
Other information
No response