From ec2ed675ef7e8373dbacd6eca690a4f278111c97 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 27 Jun 2024 15:49:32 -0500 Subject: [PATCH] Adding SignalR CustomAwaitable feature switch This is the SDK portion of changes needed to make SignalR compatible with native AOT. See https://github.com/dotnet/aspnetcore/pull/56460. --- .../Microsoft.NET.Sdk.Web.ProjectSystem.targets | 3 +++ src/WebSdk/Web/Targets/Sdk.Server.targets | 15 +++++++++++++++ test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs | 3 +++ 3 files changed, 21 insertions(+) diff --git a/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets b/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets index 9676aac013cd..e5341d39048b 100644 --- a/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets +++ b/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets @@ -57,6 +57,9 @@ Copyright (c) .NET Foundation. All rights reserved. true true + + + false diff --git a/src/WebSdk/Web/Targets/Sdk.Server.targets b/src/WebSdk/Web/Targets/Sdk.Server.targets index 749f4d70c0dc..f99e6a0a7e8f 100644 --- a/src/WebSdk/Web/Targets/Sdk.Server.targets +++ b/src/WebSdk/Web/Targets/Sdk.Server.targets @@ -31,4 +31,19 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + + + diff --git a/test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs b/test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs index 8879c6d604c2..c2b7c03288e6 100644 --- a/test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs +++ b/test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs @@ -39,6 +39,8 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe JsonNode runtimeConfig = JsonNode.Parse(runtimeConfigContents); JsonNode configProperties = runtimeConfig["runtimeOptions"]["configProperties"]; + configProperties["Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported"].GetValue() + .Should().BeFalse(); configProperties["System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"].GetValue() .Should().BeFalse(); } @@ -94,6 +96,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Aot_Apps(string targetFra string responseFile = Path.Combine(outputDirectory, "native", $"{projectName}.ilc.rsp"); var responseFileContents = File.ReadLines(responseFile); + responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported=false"); responseFileContents.Should().Contain("--feature:System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault=false"); responseFileContents.Should().Contain("--feature:System.Diagnostics.Tracing.EventSource.IsSupported=true"); responseFileContents.Should().Contain("--runtimeknob:System.GC.DynamicAdaptationMode=1");