Skip to content

Commit

Permalink
Default EnableUnsafeBinaryFormatterSerialization and EnableUnsafeUTF7…
Browse files Browse the repository at this point in the history
…Encoding in trimmed applications

Fix dotnet#14475
  • Loading branch information
eerhardt committed Jul 8, 2021
1 parent aaa6580 commit 8afb4f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<CustomResourceTypesSupport Condition="'$(CustomResourceTypesSupport)' == ''">false</CustomResourceTypesSupport>
<EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization Condition="'$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)' == ''">false</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
<EnableUnsafeBinaryFormatterSerialization Condition="'$(EnableUnsafeBinaryFormatterSerialization)' == ''">false</EnableUnsafeBinaryFormatterSerialization>
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding )' == ''">false</EnableUnsafeUTF7Encoding >
<BuiltInComInteropSupport Condition="'$(BuiltInComInteropSupport)' == ''">false</BuiltInComInteropSupport>
<AutoreleasePoolSupport Condition="'$(AutoreleasePoolSupport)' == ''">false</AutoreleasePoolSupport>
<EnableCppCLIHostActivation Condition="'$(EnableCppCLIHostActivation)' == ''">false</EnableCppCLIHostActivation>
Expand Down
28 changes: 14 additions & 14 deletions src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -679,26 +679,24 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
parsedVersion.Major >= 6)
{
JObject runtimeConfig = JObject.Parse(runtimeConfigContents);
runtimeConfig["runtimeOptions"]["configProperties"]
["System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization"].Value<bool>()
JToken configProperties = runtimeConfig["runtimeOptions"]["configProperties"];
configProperties["System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization"].Value<bool>()
.Should().BeFalse();
configProperties["System.Resources.ResourceManager.AllowCustomResourceTypes"].Value<bool>()
.Should().BeFalse();
configProperties["System.Runtime.InteropServices.BuiltInComInterop.IsSupported"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Resources.ResourceManager.AllowCustomResourceTypes"].Value<bool>()
configProperties["System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Runtime.InteropServices.BuiltInComInterop.IsSupported"].Value<bool>()
configProperties["System.Runtime.InteropServices.EnableCppCLIHostActivation"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting"].Value<bool>()
configProperties["System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Runtime.InteropServices.EnableCppCLIHostActivation"].Value<bool>()
configProperties["System.StartupHookProvider.IsSupported"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.StartupHookProvider.IsSupported"].Value<bool>()
configProperties["System.Text.Encoding.EnableUnsafeUTF7Encoding"].Value<bool>()
.Should().BeFalse();
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Threading.Thread.EnableAutoreleasePool"].Value<bool>()
configProperties["System.Threading.Thread.EnableAutoreleasePool"].Value<bool>()
.Should().BeFalse();
}
else
Expand All @@ -708,7 +706,9 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
runtimeConfigContents.Should().NotContain("System.Runtime.InteropServices.BuiltInComInterop.IsSupported");
runtimeConfigContents.Should().NotContain("System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting");
runtimeConfigContents.Should().NotContain("System.Runtime.InteropServices.EnableCppCLIHostActivation");
runtimeConfigContents.Should().NotContain("System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization");
runtimeConfigContents.Should().NotContain("System.StartupHookProvider.IsSupported");
runtimeConfigContents.Should().NotContain("System.Text.Encoding.EnableUnsafeUTF7Encoding");
runtimeConfigContents.Should().NotContain("System.Threading.Thread.EnableAutoreleasePool");
}
}
Expand Down

0 comments on commit 8afb4f2

Please sign in to comment.