-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Revert unhandled exception logic to prevent multiple calls. #120069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert unhandled exception logic to prevent multiple calls. #120069
Conversation
This reverts the behavior to .NET Framework - there is now nothing to prevent the handlers from being called multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR reverts the unhandled exception logic in .NET to match .NET Framework behavior by removing safeguards that prevented multiple calls to unhandled exception handlers. The change removes thread-based protection that was preventing handlers from being called multiple times when unhandled exceptions occur.
Key changes:
- Removed thread ID tracking logic that prevented multiple unhandled exception handler calls
- Simplified the
OnUnhandledExceptionmethod by removing concurrency control - Updated test cleanup code to remove references to the removed static field
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/AppContext.cs | Removed thread ID tracking and protection logic from OnUnhandledException method |
| src/tests/baseservices/exceptions/RaiseAppDomainUnhandledExceptionEvent/RaiseEvent.cs | Removed test cleanup code and UnsafeAccessor usage for the removed static field |
|
This needs to be ported to .NET 10. |
jkotas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
/backport to release/10.0-rc2 |
|
Started backporting to release/10.0-rc2: https://github.com/dotnet/runtime/actions/runs/17996189425 |
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/18015789538 |
This reverts the behavior to .NET Framework - there is now nothing to prevent the handlers from being called
multiple times.
Fixes #119968
Fixes #119731
Replaces #119734
/cc @janvorli