Skip to content

Commit 148a281

Browse files
committed
CSharpTypePrinter: Fix for boolean arrays
1 parent 2612ff2 commit 148a281

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Generator/Generators/CSharp/CSharpTypePrinter.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ public override TypePrinterResult VisitArrayType(ArrayType array,
124124
return $"{prefix}string[]";
125125
}
126126

127+
if (arrayType.IsPrimitiveType(PrimitiveType.Bool))
128+
{
129+
var prefix = ContextKind == TypePrinterContextKind.Managed ? string.Empty :
130+
"[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1)] ";
131+
return $"{prefix}bool[]";
132+
}
133+
127134
if (Context.Options.UseSpan && !(array.SizeType != ArrayType.ArraySize.Constant &&
128135
MarshalKind == MarshalKind.ReturnVariableArray))
129136
{

0 commit comments

Comments
 (0)