-
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 storage of stack trace of exception from reflection #106901
Conversation
There was one more case where we have saved the stack trace into the _remoteStackTraceString field in the exception when the exception was passing from reflection invoked code to the caller of that code. While there is no visible difference in the Exception.ToString, a SOS test was failing due to that. And it is not necessary to save the stack trace there. I have thought about the cases when we really need the stack trace saved into the _remoteStackTraceString and I believe that actually the only case is when an existing exception is thrown again in managed code. So I have removed the option to save the stack trace from all the variants of the DispatchManagedException.
cc: @mikem8361 |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
if (preserveStackTrace) | ||
{ | ||
pThread->IncPreventAbort(); | ||
ExceptionPreserveStackTrace(throwable); |
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.
I am wondering whether the one remaining use of ExceptionPreserveStackTrace
in the VM is actually necessary. It is wrapped in very confusing logic that does not look right and we seem to be getting lucky that it never kicks in practice.
It is fine to clean it up in a separate PR.
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.
Thank you, I'll look into it separately.
/ba-g the changes are in coreclr, the legs that are failing (timing out) are NativeAOT builds only. |
Are we going to backport this to 9.0? |
@mikem8361 yes, I am planning to do that. |
/backport to release/9.0 |
Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10600017871 |
There was one more case where we have saved the stack trace into the _remoteStackTraceString field in the exception when the exception was passing from reflection invoked code to the caller of that code. While there is no visible difference in the Exception.ToString, a SOS test was failing due to that. And it is not necessary to save the stack trace there. I have thought about the cases when we really need the stack trace saved into the _remoteStackTraceString and I believe that actually the only case is when an existing exception is thrown again in managed code. So I have removed the option to save the stack trace from all the variants of the DispatchManagedException.
There was one more case where we have saved the stack trace into the
_remoteStackTraceString
field in the exception when the exception was passing from reflection invoked code to the caller of that code. While there is no visible difference in theException.ToString
, a SOS test was failing due to that. And it is not necessary to save the stack trace there.I have thought about the cases when we really need the stack trace saved into the
_remoteStackTraceString
and I believe that actually the only case is when an existing exception is thrown again in managed code. So I have removed the option to save the stack trace from all the variants of theDispatchManagedException
.