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

Add support for IsEnhancedModelMetadataSupported feature switch #42310

Merged
merged 1 commit into from
Jul 23, 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 @@ -60,6 +60,7 @@ Copyright (c) .NET Foundation. All rights reserved.

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

<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/WebSdk/Web/Targets/Sdk.Server.targets
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Copyright (c) .NET Foundation. All rights reserved.
Condition="'$(SignalRCustomAwaitableSupport)' != ''"
Value="$(SignalRCustomAwaitableSupport)"
Trim="true" />
<RuntimeHostConfigurationOption Include="Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported"
Condition="'$(MvcEnhancedModelMetadataSupport)' != ''"
Value="$(MvcEnhancedModelMetadataSupport)"
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 @@ -41,6 +41,8 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe

configProperties["Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported"].GetValue<bool>()
.Should().BeFalse();
configProperties["Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported"].GetValue<bool>()
.Should().BeFalse();
configProperties["System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"].GetValue<bool>()
.Should().BeFalse();
}
Expand Down Expand Up @@ -97,6 +99,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Aot_Apps(string targetFra
var responseFileContents = File.ReadLines(responseFile);

responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported=false");
responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported=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
Loading