From c8cdb8e05827e394022cf592bbd4a051637250ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=A4geli?= Date: Thu, 3 Sep 2026 07:24:47 +0200 Subject: [PATCH 1/3] Enable runtime-async on code generated assemblies --- Modules/Reflection/Generation/DelegateProvider.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Modules/Reflection/Generation/DelegateProvider.cs b/Modules/Reflection/Generation/DelegateProvider.cs index b2ff8272e..e5fdd8c91 100644 --- a/Modules/Reflection/Generation/DelegateProvider.cs +++ b/Modules/Reflection/Generation/DelegateProvider.cs @@ -4,6 +4,7 @@ using GenHTTP.Api.Content; using GenHTTP.Api.Protocol; + using GenHTTP.Modules.IO; using GenHTTP.Modules.Reflection.Operations; using GenHTTP.Modules.Reflection.Routing; @@ -24,6 +25,14 @@ internal static class DelegateProvider deterministic: false ); + private static readonly CSharpParseOptions? ParseOptions = +#if NET11_0_OR_GREATER + new CSharpParseOptions(LanguageVersion.Preview) + .WithFeatures([new KeyValuePair("runtime-async", "on")]); +#else + null; +#endif + private static bool _requirementsLoaded; /// @@ -35,7 +44,7 @@ internal static class DelegateProvider /// Thrown if the compilation failed for some reason internal static Func> Compile(string code) { - var syntaxTree = CSharpSyntaxTree.ParseText(code); + var syntaxTree = CSharpSyntaxTree.ParseText(code, ParseOptions); var assemblyName = Path.GetRandomFileName(); @@ -88,7 +97,7 @@ private static MetadataReference[] GetReferences() _requirementsLoaded = true; } - return References.Values.ToArray(); + return [.. References.Values]; } private static MetadataReference LoadAssembly(string fullName) From 261cb5f260421371b5be757f9fa04b2ec32f327b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=A4geli?= Date: Thu, 3 Sep 2026 07:31:13 +0200 Subject: [PATCH 2/3] Prepare the csproj to hold both the .NET 10 and 11 tool chain ref --- Modules/Reflection/GenHTTP.Modules.Reflection.csproj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj index 7bb9c1cd5..eeebd993d 100644 --- a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj +++ b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj @@ -18,7 +18,13 @@ - + + + + + + + From 4d0c8eb54e324af440e531777eb1a9c575c20d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=A4geli?= Date: Thu, 3 Sep 2026 07:55:54 +0200 Subject: [PATCH 3/3] Fix csproj and update nugets --- .../Reflection/GenHTTP.Modules.Reflection.csproj | 16 ++++++++-------- .../Acceptance/GenHTTP.Testing.Acceptance.csproj | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj index eeebd993d..86bf66747 100644 --- a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj +++ b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj @@ -18,18 +18,18 @@ - - - - - - - - + + + + + + + + diff --git a/Testing/Acceptance/GenHTTP.Testing.Acceptance.csproj b/Testing/Acceptance/GenHTTP.Testing.Acceptance.csproj index 4b9a2cff6..52827ecad 100644 --- a/Testing/Acceptance/GenHTTP.Testing.Acceptance.csproj +++ b/Testing/Acceptance/GenHTTP.Testing.Acceptance.csproj @@ -55,7 +55,7 @@ - +