From c5fc18c94ed9fbb1dce04ee0c9327a261e4e6a66 Mon Sep 17 00:00:00 2001 From: sonyps5201314 Date: Wed, 29 Oct 2025 04:43:07 +0800 Subject: [PATCH] Fixed an issue where the `Range` type in "https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Polyfills/Range.cs" could not be decompiled correctly after adjusting the judgment logic of the primary constructor. --- .../Transforms/TransformFieldAndConstructorInitializers.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs b/ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs index 227148aea..6bbd82096 100644 --- a/ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs +++ b/ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs @@ -233,6 +233,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms if (v?.Kind == IL.VariableKind.Parameter) { isStructPrimaryCtor = record?.PrimaryConstructor != null; + if (!isStructPrimaryCtor) + { + // When there is no primary constructor, assignments from constructor parameters to fields or properties cannot be transferred. + break; + } if (fieldOrPropertyOrEvent is IField f) fieldToVariableMap.Add(f, v); }