Skip to content

Conversation

@janvorli
Copy link
Member

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

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
@janvorli janvorli added this to the 10.0.0 milestone Jul 18, 2025
@janvorli janvorli requested a review from jkotas July 18, 2025 01:08
@janvorli janvorli self-assigned this Jul 18, 2025
Copilot AI review requested due to automatic review settings July 18, 2025 01:08
Copy link
Contributor

Copilot AI left a 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 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 IsAsyncThreadException function 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 if statement for "mainhardware" should be changed to else if to maintain proper control flow consistency with the rest of the conditional chain.
            else if (args[0] == "mainhardware")

@janvorli
Copy link
Member Author

/ba-g the test failures are known - #117795

@janvorli janvorli merged commit af872f0 into dotnet:main Jul 18, 2025
99 of 105 checks passed
@janvorli janvorli deleted the report-unhandled-async-exceptions branch July 18, 2025 11:30
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught ThreadInterruptedException does not print unhandled exception message to console

2 participants