Skip to content
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

Fix exception propagation from managed to native on Unix #112957

Merged

Conversation

janvorli
Copy link
Member

The new exception handling on Unix doesn't prevent propagation of exceptions from managed to external native code like the old one did. Instead of reporting an unhandled exception, it rethrows the PAL_SEHException that later ends up being reported as C++ unhandled exception.

This change fixes that behavior by enabling exception propagation from managed to native code only for the case when the native caller is CallDescrWorkerInternal.

Close #112497

The new exception handling on Unix doesn't prevent propagation of exceptions
from managed to external native code like the old one did. Instead of
reporting an unhandled exception, it rethrows the PAL_SEHException that
later ends up being reported as C++ unhandled exception.

This change fixes that behavior by enabling exception propagation from managed
to native code only for the case when the native caller is CallDescrWorkerInternal.
@janvorli janvorli requested a review from jkotas February 26, 2025 17:16
@janvorli janvorli self-assigned this Feb 26, 2025
@Copilot Copilot bot review requested due to automatic review settings February 26, 2025 17:16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@janvorli
Copy link
Member Author

Hmm, something doesn't work as expected, lot of the tests are failing. I am looking into it.

When doing final rebasing on main where the IsCallDescrWorkerInternalReturnAddress
was added in the meanwhile, I've acidentally caused the condition to be reverse
for the added check. That caused the CI test failures.
The exception in filter was incorrectly rejected as coming from external native code
@janvorli janvorli merged commit 6e2274c into dotnet:main Mar 4, 2025
94 checks passed
@janvorli janvorli deleted the fix-unix-exception-propagation-to-native branch March 4, 2025 22:32
@theolivenbaum
Copy link

@janvorli Is this already released or planned for a patch release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PAL_SEHException thrown from managed code when called from native code
3 participants