Skip to content

Commit 67b96df

Browse files
authored
Add support for IsEnhancedModelMetadataSupported feature switch (#42283)
1 parent 0faaa34 commit 67b96df

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Copyright (c) .NET Foundation. All rights reserved.
6060

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

6566
<PropertyGroup>

src/WebSdk/Web/Targets/Sdk.Server.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Copyright (c) .NET Foundation. All rights reserved.
4444
Condition="'$(SignalRCustomAwaitableSupport)' != ''"
4545
Value="$(SignalRCustomAwaitableSupport)"
4646
Trim="true" />
47+
<RuntimeHostConfigurationOption Include="Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported"
48+
Condition="'$(MvcEnhancedModelMetadataSupport)' != ''"
49+
Value="$(MvcEnhancedModelMetadataSupport)"
50+
Trim="true" />
4751
</ItemGroup>
4852

4953
</Project>

test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe
4141

4242
configProperties["Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported"].GetValue<bool>()
4343
.Should().BeFalse();
44+
configProperties["Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported"].GetValue<bool>()
45+
.Should().BeFalse();
4446
configProperties["System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"].GetValue<bool>()
4547
.Should().BeFalse();
4648
}
@@ -97,6 +99,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Aot_Apps(string targetFra
9799
var responseFileContents = File.ReadLines(responseFile);
98100

99101
responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.SignalR.Hub.IsCustomAwaitableSupported=false");
102+
responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.Mvc.ApiExplorer.IsEnhancedModelMetadataSupported=false");
100103
responseFileContents.Should().Contain("--feature:System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault=false");
101104
responseFileContents.Should().Contain("--feature:System.Diagnostics.Tracing.EventSource.IsSupported=true");
102105
responseFileContents.Should().Contain("--runtimeknob:System.GC.DynamicAdaptationMode=1");

0 commit comments

Comments
 (0)