From 3c55502fa2cec135f225d960d5da2fe6ccdac006 Mon Sep 17 00:00:00 2001 From: sonyps5201314 Date: Tue, 14 Oct 2025 18:54:07 +0800 Subject: [PATCH] Fixed an issue where the record with statement could not be decompiled correctly under .NET Framework. --- .../Transforms/TransformCollectionAndObjectInitializers.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs index b3d90d935..103765058 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs @@ -85,6 +85,11 @@ namespace ICSharpCode.Decompiler.IL.Transforms 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;