diff --git a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
index 7bb9c1cd5..86bf66747 100644
--- a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
+++ b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
@@ -18,12 +18,18 @@
-
-
+
+
+
+
+
+
+
+
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)
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 @@
-
+