-
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
Add marshallers for GeneratedComInterface-based types #86177
Add marshallers for GeneratedComInterface-based types #86177
Conversation
…omInterfaceGenerator for GeneratedComInterface types and MarshalAs(UnmanagedType.Interface) for those that like to be explicit.
…bled due to issues in our design that need to be resolved.
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/interop-contrib Issue Details
Some of the integration tests are disabled due to the following issue: Since
|
...aries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/IGetAndSetIntTests.cs
Outdated
Show resolved
Hide resolved
...ime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComInterfaceMarshaller.cs
Show resolved
Hide resolved
...ime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComInterfaceMarshaller.cs
Outdated
Show resolved
Hide resolved
...ime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComInterfaceMarshaller.cs
Show resolved
Hide resolved
…nstructor due to analyzer
...ime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComInterfaceMarshaller.cs
Show resolved
Hide resolved
…rshaller logic to avoid pre-emptive "migrate to LibraryImport" warnings.
GeneratedComInterface
-attributed types.[MarshalAs(UnmanagedType.Interface)]
on all types. If the type has theGeneratedComInterface
attribute, then the object will be marshalled as that COM interface. Otherwise it will be marshalled asIUnknown*
for whatever managed object wrapper is returned from a default-constructedStrategyBasedComWrappers
instance.[GeneratedComInterface]
or[GeneratedComClass]
or theobject
type. This may be more restrictive than required (an abstract base type of a[GeneratedComClass]
type would be reasonable to have in a parameter list and would be expensive to reliably detect), but we could design some simple rules to limit invalid usage.Some of the integration tests are disabled due to the following issue:
SinceWe will resolve this problem by changing the behavior ofCreateObjectFlags.Unwrap
will unwrap any Managed Object Wrapper from anyComWrappers
instance, we can easily get into a bad state if a COM object is implemented by ComWrappers under the hood. Our tests capture this pretty well as the "native" side is loaded into a separate ALC, so the tests fail as the underlying managed object cannot be cast to the interface on the "managed" side of the test. We need to determine a solution for this problem and enable those tests before we merge in this work.CreateObjectFlags.Unwrap
to beComWrappers
-specific. This change is specified in #86189