diff --git a/src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj b/src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj index 08c45bd4dcae..0c4bb268304d 100644 --- a/src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj +++ b/src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj @@ -26,6 +26,7 @@ false true true + false false <_EnableConsumingManagedCodeFromNativeHosting>false false diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets index 900ceef00e8b..4f249d77a179 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets @@ -558,16 +558,21 @@ Copyright (c) .NET Foundation. All rights reserved. Value="$(StartupHookSupport)" Trim="true" /> - - + + + + diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs index 0b135a68337f..1f6e624fa6ca 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs @@ -94,6 +94,7 @@ public void It_publishes_the_project_correctly(string targetFramework, string [] ""System.Runtime.TieredPGO"": true, ""System.StartupHookProvider.IsSupported"": false, ""System.Text.Encoding.EnableUnsafeUTF7Encoding"": false, + ""System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"": false, ""System.Threading.Thread.EnableAutoreleasePool"": false, ""System.Threading.ThreadPool.MinThreads"": 2, ""System.Threading.ThreadPool.MaxThreads"": 9, diff --git a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs index 2e4142f2889b..41d7514d1b49 100644 --- a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs @@ -49,6 +49,8 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe configProperties["Microsoft.AspNetCore.EnsureJsonTrimmability"].GetValue() .Should().BeTrue(); + configProperties["System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault"].GetValue() + .Should().BeFalse(); } [Theory] @@ -81,6 +83,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Aot_Apps(string targetFra var responseFileContents = File.ReadLines(responseFile); responseFileContents.Should().Contain("--feature:Microsoft.AspNetCore.EnsureJsonTrimmability=true"); + responseFileContents.Should().Contain("--feature:System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault=false"); File.Exists(Path.Combine(outputDirectory, "web.config")).Should().BeFalse(); } 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 53deab1b0dae..c9f36f9aafb9 100644 --- a/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets +++ b/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets @@ -49,6 +49,7 @@ Copyright (c) .NET Foundation. All rights reserved. true + false