Skip to content

No warning for [LibraryImport] returning a [GeneratedComInterface] with CCW options #92222

Description

@Sergio0694

Description

It seems like there's no warning from the COM generator when declaring a P/Invoke returning a COM object through an interface that's using ComInterfaceOptions.ManagedObjectWrapper, despite the fact the marshalling will never possibly work.

cc. @jkoritzinsky

Reproduction Steps

Paste the following code and build:

public static partial class DXGI1_3
{
    [LibraryImport("dxgi")]
    public static partial void CreateDXGIFactory2(uint flags, in Guid riid, out IDXGIFactory6 ppFactory);
}

[Guid("C1B6694F-FF09-44A9-B03C-77900A0A1D17")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[GeneratedComInterface(Options = ComInterfaceOptions.ManagedObjectWrapper)]
public partial interface IDXGIFactory6
{
}

Expected behavior

Some warning on the [LibraryImport] parameter, saying the interface is using invalid marshalling options.

Actual behavior

No warning, but the generated code will just never work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-System.Runtime.InteropServicesin-prThere is an active PR which will close this issue when it is mergedsource-generatorIndicates an issue with a source generator feature

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions