diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs index b3d90d9352..1037650588 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs @@ -85,6 +85,11 @@ void IStatementTransform.Run(Block block, int pos, StatementTransformContext con instType = c.Method.TypeArguments[0]; blockKind = BlockKind.ObjectInitializer; break; + case CastClass cc when context.Settings.WithExpressions && cc.Argument is CallInstruction innerCall && IsRecordCloneMethodCall(innerCall): + instType = innerCall.Method.DeclaringType; + blockKind = BlockKind.WithInitializer; + initInst = innerCall.Arguments.Single(); + break; case CallInstruction ci when context.Settings.WithExpressions && IsRecordCloneMethodCall(ci): instType = ci.Method.DeclaringType; blockKind = BlockKind.WithInitializer;