From 4e9fbe27f87413ca08b22e471421cbaa61dceea5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 18 Sep 2023 16:26:29 -0600 Subject: [PATCH] Emit `Unsafe.AsRef(in Value[0])` Fixes #1014 --- src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs b/src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs index a1885fc7..0350ac88 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs @@ -212,7 +212,7 @@ FixedStatementSyntax FixedBlock(SyntaxToken pointerLocalIdentifier, StatementSyn nameColon: null, TokenWithSpace(SyntaxKind.RefKeyword), InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(nameof(Unsafe)), IdentifierName(nameof(Unsafe.AsRef)))) - .WithArgumentList(ArgumentList().AddArguments(Argument(value0)))); + .WithArgumentList(ArgumentList().AddArguments(Argument(value0).WithRefKindKeyword(Token(SyntaxKind.InKeyword))))); // MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef(Value[0]), Length) InvocationExpressionSyntax createReadOnlySpanInvocation = InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("MemoryMarshal"), IdentifierName("CreateReadOnlySpan")))