From 2ed559eb3fc09ad5fb5d6988fe04a0f7bde535a2 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 2 Dec 2026 14:42:10 +0100 Subject: [PATCH] Elwig: Hotfix for .NET 11 JIT compiler error --- Elwig/Elwig.csproj | 2 ++ Elwig/Program.cs | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Elwig/Program.cs diff --git a/Elwig/Elwig.csproj b/Elwig/Elwig.csproj index c4078c8..8ed2c23 100644 --- a/Elwig/Elwig.csproj +++ b/Elwig/Elwig.csproj @@ -13,6 +13,8 @@ de-AT true App.manifest + + Elwig.Program diff --git a/Elwig/Program.cs b/Elwig/Program.cs new file mode 100644 index 0000000..9a5d8e6 --- /dev/null +++ b/Elwig/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Diagnostics; + +namespace Elwig { + // FIXME remove with .NET 11.0.1 + public static class Program { + [STAThread] + public static int Main(string[] args) { + if (Environment.GetEnvironmentVariable("DOTNET_JITMinOpts") != "1" && Environment.ProcessPath is string exePath) { + if (Process.Start(new ProcessStartInfo(exePath, args) { + UseShellExecute = false, + Environment = { ["DOTNET_JITMinOpts"] = "1" }, + }) != null) + { + return 0; + } + } + var app = new App(); + app.InitializeComponent(); + return app.Run(); + } + } +}