microsoft / CsWin32

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
MIT License
2.1k stars 90 forks source link

COM struct properties aren't getting access modifiers #785

Closed JeremyKuhne closed 1 year ago

JeremyKuhne commented 1 year ago

Actual behavior

Properties aren't getting an access modifier and are therefore private and inaccessible.

winmdroot.System.Ole.OLE_HANDLE Handle
{
    get
    {
        fixed (IPicture* pThis = &this)
        {
            winmdroot.System.Ole.OLE_HANDLE __result;
            ((delegate *unmanaged [Stdcall]<IPicture*,winmdroot.System.Ole.OLE_HANDLE* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])(pThis, &__result).ThrowOnFailure();
            return __result;
        }
    }
}

Expected behavior

They should be visible.

Repro steps

  1. NativeMethods.txt content:

    IPicture
  2. NativeMethods.json content (if present):

    {
    "$schema": "https://aka.ms/CsWin32.schema.json",
    "allowMarshaling": false,
    "useSafeHandles": false
    }
  3. Any of your own code that should be shared?

Context