Skip to content
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

Latest release generates a lot of unwanted code when marshalling/overloads are disabled #1338

Open
Sergio0694 opened this issue Jan 23, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Sergio0694
Copy link
Member

Actual behavior

Follow up from #1332 (comment).
I'd expect all COM types to only have the direct function pointer vtable slot methods, and the blittable vtable type.

Expected behavior

Some types also get a ton of unwanted stuff, like:

  • [UnmanagedCallersOnly] methods doing CCW marshalling (??)
  • PopulateVTable method
  • A managed [ComImport] interface type (this isn't even trim/AOT compatible, nor blittable, why is it here)

None of this stuff should be emitted when specifying blittable mode with no friendly overloads.
CsWin32 should literally only emit the blittable type, the vtable definition, and the IID field.

Repro steps

  1. NativeMethods.txt content:
ID3D11ShaderReflection
  1. NativeMethods.json content (if present):
{
  "$schema": "https://aka.ms/CsWin32.schema.json",
  "allowMarshaling": false,
  "useSafeHandles": false,
  "comInterop": {
    "preserveSigMethods": [
      "*"
    ]
  },
  "friendlyOverloads": {
    "enabled": false
  }
}

Context

  • CsWin32 version: 0.3.162
  • Win32Metadata version (if explicitly set by project): n/a
  • Target Framework: netstandard2.0 and net9.0 (I can repro on both)
  • LangVersion (if explicitly set by project): n/a
@Sergio0694
Copy link
Member Author

@AArnott to clarify, this is a regression in the latest stable, whereas 0.3.106 doesn't emit these unwanted methods.

@luojunyuan
Copy link

luojunyuan commented Jan 23, 2025

I may have encountered incorrect overloads and generation too when using WINEVENTPROC and HWND.Value. I can only revert to version 0.3.106.

@AArnott
Copy link
Member

AArnott commented Jan 23, 2025

@luojunyuan Please file that separately, as that sounds like a distinct issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants