Skip to content

[PreserveSig] inconsistently applied in IPicture #774

@JeremyKuhne

Description

@JeremyKuhne

Actual behavior

When generating IPicture we get the following errors in the latest build:

Windows.Win32.IPicture.g.cs(87,36): error CS0082: Type 'IPicture' already reserves a member called 'set_hPal' with the same parameter types
Windows.Win32.IPicture.g.cs(379,37): error CS0082: Type 'IPicture.Interface' already reserves a member called 'set_hPal' with the same parameter types

It's generating the following:

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

It isn't doing [PreserveSig], while the setter is. Maybe something to do with the introduction of OLE_HANDLE?

Expected behavior

All methods are [PreserveSig] when "allowMarshalling" is false.

Repro steps

  1. NativeMethods.txt content:
IPicture
  1. NativeMethods.json content:
{
  "$schema": "https://aka.ms/CsWin32.schema.json",
  "allowMarshaling": false,
  "useSafeHandles": false
}

Context

  • CsWin32 version: 0.2.123-beta
  • Target Framework: net8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpartner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions