Skip to content

Commit 00202a3

Browse files
committed
Fix sequential statements are emitted strangely in .net standard 2.0 code DOM.
This commit solves this behavior with early evaluation of iterators which are sequential statement body.
1 parent 377c736 commit 00202a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MsgPack/Serialization/CodeDomSerializers/CodeDomSerializerBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ protected override CodeDomConstruct EmitSequentialStatements( CodeDomContext con
354354
statements = statements.ToArray();
355355
Contract.Assert( statements.All( c => c.IsStatement ) );
356356
#endif
357-
return CodeDomConstruct.Statement( statements.SelectMany( s => s.AsStatements() ) );
357+
return CodeDomConstruct.Statement( statements.SelectMany( s => s.AsStatements().ToArray() ) );
358358
}
359359

360360
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated internally" )]
@@ -1715,4 +1715,4 @@ protected override CodeDomContext CreateCodeGenerationContextForSerializerCreati
17151715
#endif // DEBUG
17161716
}
17171717
}
1718-
}
1718+
}

0 commit comments

Comments
 (0)