From 1bba26cdb02ba05ae11e272713155ec9adfc52bd Mon Sep 17 00:00:00 2001
From: ds5678 <49847914+ds5678@users.noreply.github.com>
Date: Mon, 5 May 2025 16:48:55 -0700
Subject: [PATCH] Fix stack overflow exception in CSharpResolver
---
.../ICSharpCode.Decompiler.Tests.csproj | 2 +
.../ILPrettyTestRunner.cs | 6 +++
.../TestCases/ILPretty/Issue3466.cs | 14 ++++++
.../TestCases/ILPretty/Issue3466.il | 49 +++++++++++++++++++
.../CSharp/Resolver/CSharpResolver.cs | 2 +-
5 files changed, 72 insertions(+), 1 deletion(-)
create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue3466.cs
create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue3466.il
diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
index 5a89e7178..f7c49347a 100644
--- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
+++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
@@ -94,6 +94,7 @@
+
@@ -135,6 +136,7 @@
+
diff --git a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
index aebbf8c09..abdc031fa 100644
--- a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
@@ -219,6 +219,12 @@ namespace ICSharpCode.Decompiler.Tests
await Run();
}
+ [Test]
+ public async Task Issue3466()
+ {
+ await Run();
+ }
+
[Test]
public async Task Issue2260SwitchString()
{
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue3466.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue3466.cs
new file mode 100644
index 000000000..875cae068
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue3466.cs
@@ -0,0 +1,14 @@
+namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty
+{
+ public class Issue3466
+ {
+ public static implicit operator Issue3466(T t)
+ {
+ return null;
+ }
+ public static bool M(Issue3466