Skip to content

Fix NativeAOT COM custom query interface exception handling#117691

Merged
janvorli merged 2 commits into
dotnet:mainfrom
janvorli:fix-com-custom-query-interface-exception-handling-nativeaot
Jul 16, 2025
Merged

Fix NativeAOT COM custom query interface exception handling#117691
janvorli merged 2 commits into
dotnet:mainfrom
janvorli:fix-com-custom-query-interface-exception-handling-nativeaot

Conversation

@janvorli

@janvorli janvorli commented Jul 15, 2025

Copy link
Copy Markdown
Member

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

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.
@janvorli janvorli added this to the 10.0.0 milestone Jul 15, 2025
@janvorli janvorli self-assigned this Jul 15, 2025
Copilot AI review requested due to automatic review settings July 15, 2025 23:29
@janvorli janvorli added the area-ExceptionHandling-coreclr only use for closed issues label Jul 15, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

@janvorli

Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky jkoritzinsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment otherwise LGTM

@janvorli

Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@janvorli janvorli changed the title Fix NativeAOT COM custom query interface exceptioon handling Fix NativeAOT COM custom query interface exception handling Jul 16, 2025
@janvorli

Copy link
Copy Markdown
Member Author

/ba-g the android test timing out is a known issue.

@janvorli janvorli merged commit a436284 into dotnet:main Jul 16, 2025
153 of 169 checks passed
@janvorli janvorli deleted the fix-com-custom-query-interface-exception-handling-nativeaot branch July 16, 2025 19:32
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ExceptionHandling-coreclr only use for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NativeAOT] Regressions\coreclr\GitHub_117393\test117393 test failing in outerloop

5 participants