Add test case for RavenDB's AV issue (#89493)
authorEgor Bogatov <egorbo@gmail.com>
Wed, 26 Jul 2023 14:17:12 +0000 (16:17 +0200)
committerGitHub <noreply@github.com>
Wed, 26 Jul 2023 14:17:12 +0000 (16:17 +0200)
src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.csproj [new file with mode: 0644]

diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.cs b/src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.cs
new file mode 100644 (file)
index 0000000..0a8d260
--- /dev/null
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+public class Runtime_87597
+{
+    interface IFace
+    {
+        static IFace() {}
+        void Method();
+    }
+
+    class GenericType<T> : IFace
+    {
+        static GenericType()
+        {
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public void Method()
+        {
+        }
+    }
+
+    [MethodImpl(MethodImplOptions.NoInlining)]
+    static void TestL1(IFace iface)
+    {
+        iface.Method();
+    }
+
+    [Fact]
+    public static int TestEntryPoint()
+    {
+        for (int i = 0; i < 100; i++)
+        {
+            System.Threading.Thread.Sleep(16);
+            TestL1(new GenericType<string>());
+        }
+
+        return 100;
+    }
+}
diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_87597/Runtime_87597.csproj
new file mode 100644 (file)
index 0000000..de6d5e0
--- /dev/null
@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildProjectName).cs" />
+  </ItemGroup>
+</Project>