Report unhandled async exceptions#117799
Merged
janvorli merged 1 commit intodotnet:mainfrom Jul 18, 2025
Merged
Conversation
Async exceptions like the ThreadInterruptedException are explicitly prevented from logging unhandled exception details to console. This change removes this special handling and lets them be reported as any other unhandled exception. Close dotnet#107594
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the CoreCLR runtime to report async thread exceptions (like ThreadInterruptedException) as unhandled exceptions, removing special handling that previously prevented these exceptions from being logged to console.
Key changes:
- Removes the
IsAsyncThreadExceptionfunction that identified async exceptions for special treatment - Updates unhandled exception reporting logic to treat async exceptions like any other unhandled exception
- Adds comprehensive tests for ThreadInterruptedException handling on both main and secondary threads
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/excep.h | Removes declaration of IsAsyncThreadException function |
| src/coreclr/vm/excep.cpp | Removes IsAsyncThreadException implementation and its usage in exception handling logic |
| src/tests/baseservices/exceptions/unhandled/unhandled.cs | Adds test cases for ThreadInterruptedException on main and secondary threads |
| src/tests/baseservices/exceptions/unhandled/unhandledTester.cs | Adds test validation for ThreadInterruptedException unhandled exception output |
Comments suppressed due to low confidence (1)
src/tests/baseservices/exceptions/unhandled/unhandled.cs:51
- The if-else chain should be consistently structured. The original
ifstatement for "mainhardware" should be changed toelse ifto maintain proper control flow consistency with the rest of the conditional chain.
else if (args[0] == "mainhardware")
jkotas
approved these changes
Jul 18, 2025
Member
Author
|
/ba-g the test failures are known - #117795 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Async exceptions like the ThreadInterruptedException are explicitly prevented from logging unhandled exception details to console.
This change removes this special handling and lets them be reported as any other unhandled exception.
Close #107594