From caa21049ab788baf0c805c76e7f12fa55e2b26e9 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 9 Aug 2026 13:24:25 +0200 Subject: [PATCH] Cover nested deconstruction of record structs with a fixture Issue #3275 reported an ArgumentOutOfRangeException in ExpressionBuilder.ConstructTuple for exactly this shape; the crash was fixed by the nested-deconstruction rework, but no fixture pinned the record-struct variant, whose Deconstruct methods are compiler-generated. Assisted-by: Claude:claude-fable-5:Claude Code --- .../TestCases/Pretty/Records.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs index 1a88b0f4e..75f65536f 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs @@ -285,6 +285,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public record struct PairWithPrimaryCtor(A First, B Second); + public readonly record struct BoundsInfo(int Profile, Bounds Bounds); + + public readonly record struct Bounds(ulong Small, ulong Large); + public record struct PrimaryCtor(int A, string B); public record struct MultipleCtorsNoPrimaryCtor @@ -447,6 +451,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty C = 1.41; } } + + private static BoundsInfo GetInfo() + { + return new BoundsInfo(1, new Bounds(2uL, 3uL)); + } + + public static void NestedDeconstruction() + { + var (value, (value2, value3)) = GetInfo(); + Console.WriteLine(value); + Console.WriteLine(value2); + Console.WriteLine(value3); + } } internal class RecordsWithCustomSynthesizedMembers