-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix NativeAOT COM custom query interface exception handling #117691
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 NativeAOT COM custom query interface exception handling #117691
Conversation
After fixing a bug in the related stuff in coreclr, the regression test has revealed that the NativeAOT version has a similar issue. The exception stemming from the custom query interface are not caught and transformed to HRESULT, so they are reported as unhandled exceptions. This change adds try / catch to catch the exception and translate it to HRESULT.
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.
Pull Request Overview
This PR fixes exception handling in NativeAOT COM custom query interface implementation to match a similar fix applied to CoreCLR. The issue was that exceptions from custom query interface calls were not being caught and converted to HRESULTs, causing them to be reported as unhandled exceptions instead of proper COM error codes.
- Adds try-catch block around custom query interface calls
- Converts caught exceptions to HRESULT return values
- Ensures consistent COM exception handling between CoreCLR and NativeAOT
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
One comment otherwise LGTM
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
Show resolved
Hide resolved
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/ba-g the android test timing out is a known issue. |
After fixing a bug in the related stuff in coreclr, the regression test has revealed that the NativeAOT version has a similar issue. The exception stemming from the custom query interface are not caught and transformed to HRESULT, so they are reported as unhandled exceptions.
This change adds try / catch to catch the exception and translate it to HRESULT.
Close #117654