Closed riverar closed 8 months ago
As a workaround for now, please use (string)null
as the argument.
or (PCWSTR)null
, if you don't want the SafeHandle return type.
Given the ease of resolving the ambiguity, and that such ambiguities may appear in many other APIs, often unrelated to PCWSTR
, and C# developers tend to know how to resolve them, I'm inclined to Won't Fix this to avoid adding APIs when existing solutions exist.
Thoughts?
I'm okay with closure, no ill feelings.
C# developers tend to know how to resolve them
I would gently push back on this and say in my decades of writing C#, I never actually hit this scenario. I think the .NET API team very carefully and cleverly avoided creating API overloads like this.
GetModuleHandle
has two overloads(string lpModuleName)
(winmdroot.Foundation.PCWSTR lpModuleName)
Passing in a
null
creates overload ambiguity and therefore cannot be used.Similar to https://github.com/microsoft/CsWin32/issues/639
This might be a moot request if the overloads are reduced as a result of resolving https://github.com/microsoft/CsWin32/issues/1068