From 07d068dcaf36ab3c743f7919ddeda4a16e1562b5 Mon Sep 17 00:00:00 2001
From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
Date: Fri, 31 Jul 2026 16:46:07 -0700
Subject: [PATCH 1/3] Add reproZero NativeAOT compiler project
---
.../aot/ILCompiler/reproZero/reproZero.csproj | 64 +++++++++
.../aot/ILCompiler/reproZero/zerosharp.cs | 126 ++++++++++++++++++
2 files changed, 190 insertions(+)
create mode 100644 src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
create mode 100644 src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
diff --git a/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj b/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
new file mode 100644
index 00000000000000..868cd57b39cbe1
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
@@ -0,0 +1,64 @@
+
+
+
+ $(NetCoreAppToolCurrent)
+ Exe
+ x64;x86;wasm
+ AnyCPU
+ false
+ false
+ Debug;Release;Checked
+ true
+ false
+ true
+ true
+ false
+ false
+ false
+ v4.0.30319
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs b/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
new file mode 100644
index 00000000000000..f28c02a17ec3bd
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Runtime;
+using System.Runtime.InteropServices;
+
+#region A couple very basic things
+namespace System
+{
+ public class Object
+ {
+#pragma warning disable 169
+ // The layout of object is a contract with the compiler.
+ private IntPtr m_pMethodTable;
+#pragma warning restore 169
+ }
+ public struct Void { }
+
+ // The layout of primitive types is special cased because it would be recursive.
+ // These really don't need any fields to work.
+ public struct Boolean { }
+ public struct Char { }
+ public struct SByte { }
+ public struct Byte { }
+ public struct Int16 { }
+ public struct UInt16 { }
+ public struct Int32 { }
+ public struct UInt32 { }
+ public struct Int64 { }
+ public struct UInt64 { }
+ public struct IntPtr { }
+ public struct UIntPtr { }
+ public struct Single { }
+ public struct Double { }
+
+ public abstract class ValueType { }
+ public abstract class Enum : ValueType { }
+
+ public struct Nullable where T : struct { }
+
+ public sealed class String { public readonly int Length; }
+ public abstract class Array { }
+ public abstract class Delegate { }
+ public abstract class MulticastDelegate : Delegate { }
+
+ public struct RuntimeTypeHandle { }
+ public struct RuntimeMethodHandle { }
+ public struct RuntimeFieldHandle { }
+
+ public class Attribute { }
+
+ public enum AttributeTargets { }
+
+ public sealed class AttributeUsageAttribute : Attribute
+ {
+ public AttributeUsageAttribute(AttributeTargets validOn) { }
+ public bool AllowMultiple { get; set; }
+ public bool Inherited { get; set; }
+ }
+
+ public class AppContext
+ {
+ public static void SetData(string s, object o) { }
+ }
+
+ namespace Runtime.CompilerServices
+ {
+ public class RuntimeHelpers
+ {
+ public static unsafe int OffsetToStringData => sizeof(IntPtr) + sizeof(int);
+ }
+ }
+}
+namespace System.Runtime.InteropServices
+{
+ public sealed class DllImportAttribute : Attribute
+ {
+ public DllImportAttribute(string dllName) { }
+ }
+}
+#endregion
+
+#region Things needed by ILC
+namespace System
+{
+ namespace Runtime
+ {
+ internal sealed class RuntimeExportAttribute : Attribute
+ {
+ public RuntimeExportAttribute(string entry) { }
+ }
+ }
+
+ class Array : Array { }
+}
+
+namespace Internal.Runtime.CompilerHelpers
+{
+ // A class that the compiler looks for that has helpers to initialize the
+ // process. The compiler can gracefully handle the helpers not being present,
+ // but the class itself being absent is unhandled. Let's add an empty class.
+ class StartupCodeHelpers
+ {
+ // A couple symbols the generated code will need we park them in this class
+ // for no particular reason. These aid in transitioning to/from managed code.
+ // Since we don't have a GC, the transition is a no-op.
+ [RuntimeExport("RhpReversePInvoke")]
+ static void RhpReversePInvoke(IntPtr frame) { }
+ [RuntimeExport("RhpReversePInvokeReturn")]
+ static void RhpReversePInvokeReturn(IntPtr frame) { }
+ [RuntimeExport("RhpPInvoke")]
+ static void RhpPInvoke(IntPtr frame) { }
+ [RuntimeExport("RhpPInvokeReturn")]
+ static void RhpPInvokeReturn(IntPtr frame) { }
+
+ [RuntimeExport("RhpFallbackFailFast")]
+ static void RhpFallbackFailFast() { while (true) ; }
+ }
+}
+#endregion
+
+unsafe class Program
+{
+ static int Main()
+ {
+ return 42;
+ }
+}
From b61c5eb6ea84a1888bd38eede8a0c381de509d8a Mon Sep 17 00:00:00 2001
From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
Date: Sat, 1 Aug 2026 08:09:48 -0700
Subject: [PATCH 2/3] Exclude repro sources from ILCompiler
---
src/coreclr/tools/aot/ILCompiler/ILCompiler.props | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
index e901d56df167fb..84855fc2f189ad 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
@@ -52,5 +52,6 @@
+
From 106578c893d4dc54d6237ac127a4c57433b2781d Mon Sep 17 00:00:00 2001
From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
Date: Sat, 1 Aug 2026 08:16:15 -0700
Subject: [PATCH 3/3] Copilot feedback
---
src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj | 2 +-
src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj b/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
index 868cd57b39cbe1..9a501e553cfbcd 100644
--- a/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
+++ b/src/coreclr/tools/aot/ILCompiler/reproZero/reproZero.csproj
@@ -56,7 +56,7 @@
-
diff --git a/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs b/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
index f28c02a17ec3bd..14ee6552bbbc51 100644
--- a/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
+++ b/src/coreclr/tools/aot/ILCompiler/reproZero/zerosharp.cs
@@ -1,3 +1,6 @@
+ // 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;
using System.Runtime.InteropServices;