A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
2k
stars
84
forks
source link
Generated extension methods do not correctly handle optional array parameters #1041
Closed
BasTossings closed 10 months ago
Actual behavior
For example, the generated extension for
ID2D1Factory.CreateStrokeStyle
is as follows:The official API documentation states
dashes
is[in, optional]
.when you call
CreateStrokeStyle
with dashes set tonull
, you get aNullReferenceException
on(uint )dashes.Length
.Expected behavior
The generated extension methods should test for
null
on optional array parameters.Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Any of your own code that should be shared?
Context
0.3.18-beta
net7.0
LangVersion
(if explicitly set by project): n/a