Skip to content

Commit 3c55502

Browse files
committed
Fixed an issue where the record with statement could not be decompiled correctly under .NET Framework.
1 parent 126e870 commit 3c55502

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ void IStatementTransform.Run(Block block, int pos, StatementTransformContext con
8585
instType = c.Method.TypeArguments[0];
8686
blockKind = BlockKind.ObjectInitializer;
8787
break;
88+
case CastClass cc when context.Settings.WithExpressions && cc.Argument is CallInstruction innerCall && IsRecordCloneMethodCall(innerCall):
89+
instType = innerCall.Method.DeclaringType;
90+
blockKind = BlockKind.WithInitializer;
91+
initInst = innerCall.Arguments.Single();
92+
break;
8893
case CallInstruction ci when context.Settings.WithExpressions && IsRecordCloneMethodCall(ci):
8994
instType = ci.Method.DeclaringType;
9095
blockKind = BlockKind.WithInitializer;

0 commit comments

Comments
 (0)