Browse Source

Fixed an issue where the record with statement could not be decompiled correctly under .NET Framework.

pull/3595/head
sonyps5201314 3 months ago
parent
commit
3c55502fa2
  1. 5
      ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

5
ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

@ -85,6 +85,11 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -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;

Loading…
Cancel
Save