diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
index 0abd385da..2a0b45c22 100644
--- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
+++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
@@ -114,6 +114,8 @@
+
+
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.cs b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.cs
new file mode 100644
index 000000000..9cb9e05df
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+
+public class VBNonGenericForEach
+{
+ public static void M()
+ {
+ ArrayList arrayList = new ArrayList();
+ foreach (object item in arrayList)
+ {
+#if ROSLYN && OPT
+ Console.WriteLine(RuntimeHelpers.GetObjectValue(RuntimeHelpers.GetObjectValue(item)));
+#else
+ object objectValue = RuntimeHelpers.GetObjectValue(item);
+ Console.WriteLine(RuntimeHelpers.GetObjectValue(objectValue));
+#endif
+ }
+ }
+}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.vb b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.vb
new file mode 100644
index 000000000..4f3e72f76
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/VBNonGenericForEach.vb
@@ -0,0 +1,11 @@
+Imports System
+Imports System.Collections
+
+Public Class VBNonGenericForEach
+ Public Shared Sub M()
+ Dim collection = New ArrayList
+ For Each element In collection
+ Console.WriteLine(element)
+ Next
+ End Sub
+End Class
diff --git a/ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs
index b9a609cda..c6eebb827 100644
--- a/ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs
@@ -131,6 +131,12 @@ namespace ICSharpCode.Decompiler.Tests
await Run(options: options | CompilerOptions.Library);
}
+ [Test]
+ public async Task VBNonGenericForEach([ValueSource(nameof(defaultOptions))] CompilerOptions options)
+ {
+ await Run(options: options | CompilerOptions.Library);
+ }
+
async Task Run([CallerMemberName] string testName = null, CompilerOptions options = CompilerOptions.UseDebug, DecompilerSettings settings = null)
{
var vbFile = Path.Combine(TestCasePath, testName + ".vb");