Closed Rans4ckeR closed 1 year ago
I'm afraid this is by design, since the ppBuffer
is in fact allowed to be NULL
and the C# ref
syntax doesn't make it intuitive as to how to pass NULL
in. All such optional parameters are therefore declared as pointers instead of using ref
, in
or out
.
This shouldn't block any of your scenarios, as far as we're aware. It does unfortunately mean you'll need to update your callers.
One thing you could do is add a partial class to declare your own overload of this method that doesaccept
ref, and internally obtain its pointer and pass it on to the
extern` method. If you have a lot of callers of this method, this will allow you to avoid fixing them all up individually.
ref
parameters back.
Actual behavior
It seems I can no longer use several functions (BCryptEnumContexts, BCryptEnumContextFunctions, BCryptResolveProviders) because of invalid signatures.
The
DllImport
now has an[Optional]
attribute and seems to cause the overloads that previously were generated asref STRUCT*
now to be generated asSTRUCT**
.Example below for BCryptEnumContexts ppBuffer.
0.2.206-beta generates:
Expected behavior
0.2.188-beta generates:
Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Any of your own code that should be shared?
Context
0.2.206-beta
net7.0
preview