Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SignalR CustomAwaitable feature switch #41832

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Enable the built-in source generators. -->
<EnableRequestDelegateGenerator Condition="'$(EnableRequestDelegateGenerator)' == ''">true</EnableRequestDelegateGenerator>
<EnableConfigurationBindingGenerator Condition="'$(EnableConfigurationBindingGenerator)' == ''">true</EnableConfigurationBindingGenerator>

<!-- Default feature switch values for trimmed apps. -->
<SignalRCustomAwaitableSupport Condition="'$(SignalRCustomAwaitableSupport)' == ''">false</SignalRCustomAwaitableSupport>
</PropertyGroup>

<PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/WebSdk/Web/Targets/Sdk.Server.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,19 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Sdk="Microsoft.NET.Sdk.Web.ProjectSystem" Project="Sdk.targets" />

<Import Sdk="Microsoft.NET.Sdk.Publish" Project="Sdk.targets" />

<!--
============================================================
DefaultRuntimeHostConfigurationOptions
Defaults @(RuntimeHostConfigurationOption) items based on MSBuild properties.
============================================================
-->

<ItemGroup>
<RuntimeHostConfigurationOption Include="Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported"
Condition="'$(SignalRCustomAwaitableSupport)' != ''"
Value="$(SignalRCustomAwaitableSupport)"
Trim="true" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>()
.Should().BeFalse();
configProperties["System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"].GetValue<bool>()
.Should().BeFalse();
}
Expand Down Expand Up @@ -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");
Expand Down