Skip to content

Commit d66549a

Browse files
committed
Fix the unmarshalling conditions
1 parent 5eb62da commit d66549a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/ICustomNativeTypeMarshallingStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(TypePositionInfo
235235
{
236236
var subContext = new CustomNativeTypeWithValuePropertyStubContext(context);
237237

238-
if (!info.IsByRef && info.ByValueContentsMarshalKind.HasFlag(ByValueContentsMarshalKind.Out))
238+
if (info.IsManagedReturnPosition || (info.IsByRef && info.RefKind != RefKind.In))
239239
{
240240
yield return GenerateValuePropertyAssignment(info, context, subContext);
241241
}
@@ -568,7 +568,7 @@ public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(TypePositionInfo
568568
{
569569
var subContext = new CustomNativeTypeWithValuePropertyStubContext(context);
570570

571-
if (!info.IsByRef && info.ByValueContentsMarshalKind.HasFlag(ByValueContentsMarshalKind.Out))
571+
if (info.IsManagedReturnPosition || (info.IsByRef && info.RefKind != RefKind.In))
572572
{
573573
// <marshalerIdentifier>.Value = <nativeIdentifier>;
574574
yield return GenerateValuePropertyAssignment(info, context, subContext);

0 commit comments

Comments
 (0)