File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Tests/Microsoft.NET.Publish.Tests
WebSdk/ProjectSystem/Targets Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -970,6 +970,12 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
970970 . Should ( ) . BeFalse ( ) ;
971971 configProperties [ "System.Threading.Thread.EnableAutoreleasePool" ] . Value < bool > ( )
972972 . Should ( ) . BeFalse ( ) ;
973+
974+ if ( parsedVersion . Major >= 8 )
975+ {
976+ configProperties [ "System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault" ] . Value < bool > ( )
977+ . Should ( ) . BeFalse ( ) ;
978+ }
973979 }
974980 else
975981 {
@@ -1698,8 +1704,12 @@ public void Build_respects_PublishTrimmed_property(string targetFramework)
16981704
16991705 // runtimeconfig has trim settings
17001706 JObject runtimeConfig = JObject . Parse ( File . ReadAllText ( runtimeConfigPath ) ) ;
1701- JToken startupHookSupport = runtimeConfig [ "runtimeOptions" ] [ "configProperties" ] [ "System.StartupHookProvider.IsSupported" ] ;
1702- startupHookSupport . Value < bool > ( ) . Should ( ) . BeFalse ( ) ;
1707+ JToken configProperties = runtimeConfig [ "runtimeOptions" ] [ "configProperties" ] ;
1708+
1709+ configProperties [ "System.StartupHookProvider.IsSupported" ] . Value < bool > ( ) . Should ( ) . BeFalse ( ) ;
1710+
1711+ // Build with PublishTrimmed enabled should disable System.Text.Json reflection
1712+ configProperties [ "System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault" ] . Value < bool > ( ) . Should ( ) . BeFalse ( ) ;
17031713
17041714 // just setting PublishTrimmed doesn't inject the IsTrimmable attribute
17051715 AssemblyInfo . Get ( assemblyPath ) . ContainsKey ( "AssemblyMetadataAttribute" ) . Should ( ) . BeFalse ( ) ;
Original file line number Diff line number Diff line change @@ -46,11 +46,6 @@ Copyright (c) .NET Foundation. All rights reserved.
4646 <EnableUnsafeBinaryFormatterSerialization Condition =" '$(EnableUnsafeBinaryFormatterSerialization)' == ''" >false</EnableUnsafeBinaryFormatterSerialization >
4747 </PropertyGroup >
4848
49- <!-- Default settings for trimmed and aot'd apps. -->
50- <PropertyGroup Condition =" '$(PublishTrimmed)' == 'true' Or '$(PublishAot)' == 'true'" >
51- <JsonSerializerIsReflectionEnabledByDefault Condition =" '$(JsonSerializerIsReflectionEnabledByDefault)' == ''" >false</JsonSerializerIsReflectionEnabledByDefault >
52- </PropertyGroup >
53-
5449 <!-- Default settings for aot'd apps. -->
5550 <PropertyGroup Condition =" '$(PublishAot)' == 'true'" >
5651 <!-- Enable the built-in source generators. -->
You can’t perform that action at this time.
0 commit comments