-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add custom exception handlers to generated COM wrappers #114828
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
Add custom exception handlers to generated COM wrappers #114828
Conversation
This is an initial iteration to add custom exception handlers to generated COM wrappers, through a new ExceptionToUnmanagedMarshaller property in GeneratedComWrappersAttribute Fix dotnet#109522
Note regarding the
|
1 similar comment
Note regarding the
|
Tagging subscribers to this area: @dotnet/interop-contrib |
@dotnet-policy-service agree |
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs
Outdated
Show resolved
Hide resolved
Resolves an issue with previous implementation, highlighted by Jeremy. The previous implementation is overcomplicated and hooks into the default exception logic, which is not ideal. This commit copies the existing custom exception marshalling logic from the VTable stub generator.
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.
Just a few nits, but looking much better!
...s/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ISymbolExtensions.cs
Outdated
Show resolved
Hide resolved
...ies/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/BoundGenerators.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jeremy Koritzinsky <[email protected]>
Co-authored-by: Jeremy Koritzinsky <[email protected]>
...stem.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratedComInterfaceAttributeData.cs
Outdated
Show resolved
Hide resolved
...stem.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratedComInterfaceAttributeData.cs
Outdated
Show resolved
Hide resolved
...stem.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratedComInterfaceAttributeData.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Aaron Robinson <[email protected]>
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.
Changes look good. Mark this as non-draft and we can do a final review. (Also get the new test passing everywhere, looks like there's failures).
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.
LGTM Thank you!
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs
Outdated
Show resolved
Hide resolved
...raries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs
Outdated
Show resolved
Hide resolved
This is to match the common scenario. Co-authored-by: Aaron Robinson <[email protected]>
...ime.InteropServices/tests/ComInterfaceGenerator.Tests/ExceptionToUnmanagedMarshallerTests.cs
Outdated
Show resolved
Hide resolved
Thanks! |
Fixes #109522