Open
Description
Description
Consider this example:
[GeneratedComInterface, Guid(..)]
interface IComItf
{
...
}
[GeneratedComClass, Guid(..)]
class ManagedComItf : IComItf
{
...
}
then:
IComItf instNative = CreateNativeImplementation();
IComItf instManaged = new ManagedComItf();
var v1 = ComVariantMarshaller.ConvertToUnmanaged(instManaged); // works
var v2 = ComVariantMarshaller.ConvertToUnmanaged(instNative); // <--------------- does not work
because of this passing a com interface to a com method as object fails when the method has this signature:
void Method([MarshalUsing(typeof(ComVariantMarshaller))] object obj);
Additionally these are missing:
var v3 = ComVariant.Create(instNative);
var instManaged2 = v1.As<IComItf>();
PS:
this works but does not help:
var v4 = ComVariantMarshaller.ConvertToUnmanaged(new UnknownWrapper(instNative)); // works
Reproduction Steps
see description
Expected behavior
ComVariantMarshaller should be able to work directly with COM interfaces
Actual behavior
ComVariantMarshallers cannot be created from COM interfaces
Regression?
No response
Known Workarounds
No response
Configuration
.NET9
Other information
No response
Metadata
Metadata
Assignees
Type
Projects
Status
No status