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.12k stars 92 forks source link

CollectMetadataPaths should report an error when there is no metadata instead of returning an empty array #1260

Open arsdragonfly opened 3 months ago

arsdragonfly commented 3 months ago

Actual behavior

CsWin32 emits "Method, type or constant "xxx" not found error when metadata isn't found at all.

Expected behavior

CsWin32 should clearly state an error that the metadata cannot be found.

Repro steps

Irrelevant, but here's how I painstakingly WinDbg'd csc only to find out that the property isn't passed down to the compiler. Still need to figure out how that happened in my environment but that'll be an issue with my environment's setup. image

Context