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.06k stars 87 forks source link

Please don't add cast operators to System.Drawing types when System.Drawing is not installed #934

Closed wherewhere closed 1 year ago

wherewhere commented 1 year ago

Actual behavior

image

Expected behavior

Don't generate it when System.Drawing is not installed. It will be better if it can generate cast operators to Windows.Foundation image

Repro steps

  1. NativeMethods.txt content:
    RECT

Context

wherewhere commented 1 year ago

626

AArnott commented 1 year ago

We should be able to suppress generation of these when the types it references aren't included in the compilation. Windows.Foundation cast operations is an option we could do when those types exist in the compilation as well.