Repository navigation
Conversation
dotnet#133662 changed the first reflection invocation from: MethodInfo.Invoke -> RuntimeMethodHandle_InvokeMethod (QCall) -> CallDescrWorkerWithHandler -> target method to this path when the CoreLib thunk is interpreted: MethodInfo.Invoke -> InvokeWithSharedThunk -> IntrinsicInvokeHelper.Invoke -> shared thunk -> InvokeCalliStub -> pHeader->Invoke -> target method The old path had exception handling around the target call. The new pHeader->Invoke call was not wrapped in a Windows SEH handler. Loading a type or assembly while preparing the target can raise a CLR exception as SEH before the target body runs. That exception could miss the interpreted caller's catch block. Wrap pHeader->Invoke with CallWithSEHWrapper on Windows. The handler passes the CLR's existing exception object to DispatchManagedException so the interpreter can find the caller's catch block. Also allow the wrapper to call void functions and extend GitHub_76531 to cover MethodInfo.Invoke and MethodInvoker.Invoke. The handler uses LastThrownObject; it does not turn raw native SEH codes into managed exceptions. The calli_excep test remains skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 752296b7-8fe1-428c-9643-012fd69699ee
Member
Author
|
/azp run runtime-interpreter |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli |
Member
Author
|
/azp run runtime-interpreter |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#133662 changed the first reflection invocation from:
MethodInfo.Invoke
-> RuntimeMethodHandle_InvokeMethod (QCall)
-> CallDescrWorkerWithHandler
-> target method
to this path when the CoreLib thunk is interpreted:
MethodInfo.Invoke
-> InvokeWithSharedThunk
-> IntrinsicInvokeHelper.Invoke
-> shared thunk
-> InvokeCalliStub
-> pHeader->Invoke
-> target method
The old path had exception handling around the target call. The new pHeader->Invoke call was not wrapped in a Windows SEH handler. Loading a type or assembly while preparing the target can raise a CLR exception as SEH before the target body runs. That exception could miss the interpreted caller's catch block.
Wrap pHeader->Invoke with CallWithSEHWrapper on Windows. The handler passes the CLR's existing exception object to DispatchManagedException so the interpreter can find the caller's catch block. Also allow the wrapper to call void functions and extend GitHub_76531 to cover MethodInfo.Invoke and MethodInvoker.Invoke.
The handler uses LastThrownObject; it does not turn raw native SEH codes into managed exceptions. The calli_excep test remains skipped.