Skip to content

Commit

Permalink
Add support for IsEnhancedModelMetadataSupported feature switch (#42310)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpopMSFT authored Jul 23, 2024
2 parents 3b85146 + 2f56cb7 commit 557f8b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
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

0 comments on commit 557f8b8

Please sign in to comment.