Skip to content

Commit

Permalink
Fix the unmarshalling conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky committed Nov 16, 2021
1 parent 5eb62da commit d66549a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(TypePositionInfo
{
var subContext = new CustomNativeTypeWithValuePropertyStubContext(context);

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

if (!info.IsByRef && info.ByValueContentsMarshalKind.HasFlag(ByValueContentsMarshalKind.Out))
if (info.IsManagedReturnPosition || (info.IsByRef && info.RefKind != RefKind.In))
{
// <marshalerIdentifier>.Value = <nativeIdentifier>;
yield return GenerateValuePropertyAssignment(info, context, subContext);
Expand Down

0 comments on commit d66549a

Please sign in to comment.