-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 missing frame on inner exception stack trace in release build #105482
Merged
janvorli
merged 1 commit into
dotnet:main
from
janvorli:fix-missing-frame-on-eh-stacktrace-release-build
Jul 26, 2024
Merged
Fix missing frame on inner exception stack trace in release build #105482
janvorli
merged 1 commit into
dotnet:main
from
janvorli:fix-missing-frame-on-eh-stacktrace-release-build
Jul 26, 2024
Conversation
This file contains 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
There is a problem in release builds of the runtime that was discovered by SOS tests. When an exception is thrown from reflection code, the inner exception was missing the frame(s) from the reflection called code on the stack trace and had them in the `_remoteStackTraceString` instead. So getting the exception stack trace as string still worked correctly. In checked or debug builds, it was working as expected. It turned out that the issue was caused by the fact that when an exception is rethrown as native one when exception unwinding reaches native frames, it used `RealCOMPlusThrow` method. The catch was that while in debug / checked builds it was using this method with Object* argument, in release builds, the `OBJECTREF` and Object* are the same thing, so the `RealCOMPlusThrow` with the explicit Object* was not compiled and we were using the one with the OBJECTREF argument. Unfortunately, that one has a different semantics - to save the current stack trace into the `_remoteStackTraceString` and then building it from scratch. The fix was to rename the RealCOMPlusThrow version with the Object* argument to a different name so that it can be built for release, checked and debug builds and used for the specific purpose of propagating managed exception through the native frames.
cc: @mikem8361 - this fixes the issue you have shared with me yesterday. |
mikem8361
approved these changes
Jul 25, 2024
jkotas
approved these changes
Jul 25, 2024
This was referenced Jul 25, 2024
Closed
/azp run coreclr-outerloop |
No pipelines are associated with this pull request. |
/azp run coreclr-outerloop |
No pipelines are associated with this pull request. |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
The outerloop failures seem to be the #105441 |
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.
There is a problem in release builds of the runtime that was discovered by SOS tests. When an exception is thrown from reflection code, the inner exception was missing the frame(s) from the reflection called code on the stack trace and had them in the
_remoteStackTraceString
instead. So getting the exception stack trace as string still worked correctly. In checked or debug builds, it was working as expected.It turned out that the issue was caused by the fact that when an exception is rethrown as native one when exception unwinding reaches native frames, it used
RealCOMPlusThrow
method. The catch was that while in debug / checked builds it was using this method withObject*
argument, in release builds, theOBJECTREF
andObject*
are the same thing, so theRealCOMPlusThrow
with the explicitObject*
was not compiled and we were using the one with theOBJECTREF
argument. Unfortunately, that one has a different semantics - to save the current stack trace into the_remoteStackTraceString
and then building it from scratch.The fix was to rename the
RealCOMPlusThrow
version with theObject*
argument to a different name so that it can be built for release, checked and debug builds and used for the specific purpose of propagating managed exception through the native frames.