Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding default feature switch for CustomResourceTypesSupport #15702

Merged
6 commits merged into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
<TieredCompilationQuickJitForLoops>true</TieredCompilationQuickJitForLoops>
<StartupHookSupport>false</StartupHookSupport>
<CustomResourceTypesSupport>false</CustomResourceTypesSupport>
<EventSourceSupport>false</EventSourceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Turn off symbol publishing by default -->
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>

<!-- Trimmer defaults -->
<PublishTrimmed Condition="'$(PublishTrimmed)' == ''">true</PublishTrimmed>
<TrimMode Condition="'$(TrimMode)' == ''">link</TrimMode>
<TrimmerRemoveSymbols Condition="'$(TrimmerRemoveSymbols)' == ''">false</TrimmerRemoveSymbols>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk.Razor" Project="Sdk.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<SelfContained>true</SelfContained>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

<!-- Trimmer defaults -->
<PublishTrimmed Condition="'$(PublishTrimmed)' == ''">true</PublishTrimmed>
<TrimMode Condition="'$(TrimMode)' == ''">link</TrimMode>
<TrimmerRemoveSymbols Condition="'$(TrimmerRemoveSymbols)' == ''">false</TrimmerRemoveSymbols>

<!-- Runtime feature defaults to trim unnecessary code -->
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ Copyright (c) .NET Foundation. All rights reserved.
could be removed by the linker, causing a trimmed app to crash. -->
<PropertyGroup Condition="'$(StartupHookSupport)' == '' And
'$(PublishTrimmed)' == 'true' And
joperezr marked this conversation as resolved.
Show resolved Hide resolved
'$(_TargetFrameworkVersionWithoutV)' >= '6.0'">
$([MSBuild]::VersionGreaterThanOrEquals($(_TargetFrameworkVersionWithoutV), '6.0'))">
<StartupHookSupport>false</StartupHookSupport>
</PropertyGroup>

<!-- We disable custom resource types for trimmed apps here so that the feature
switch can flow to the runtimeconfig.json. Custom resource types are disabled
by default since they may require assemblies, types or members that
could be removed by the linker, causing a trimmed app to crash. -->
<PropertyGroup Condition="'$(CustomResourceTypesSupport)' == '' And
'$(PublishTrimmed)' == 'true' And
$([MSBuild]::VersionGreaterThanOrEquals($(_TargetFrameworkVersionWithoutV), '6.0'))">
<CustomResourceTypesSupport>false</CustomResourceTypesSupport>
</PropertyGroup>

<!--
============================================================
ILLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ Copyright (c) .NET Foundation. All rights reserved.
Value="$(HttpActivityPropagationSupport)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Resources.ResourceManager.AllowCustomResourceTypes"
Condition="'$(CustomResourceTypesSupport)' != ''"
Value="$(CustomResourceTypesSupport)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Resources.UseSystemResourceKeys"
Condition="'$(UseSystemResourceKeys)' != ''"
Value="$(UseSystemResourceKeys)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void It_publishes_the_project_correctly(string targetFramework, string []
""System.Runtime.TieredCompilation.QuickJit"": true,
""System.Runtime.TieredCompilation.QuickJitForLoops"": true,
""System.StartupHookProvider.IsSupported"": false,
""System.Resources.ResourceManager.AllowCustomResourceTypes"": false,
""System.Text.Encoding.EnableUnsafeUTF7Encoding"": false,
""System.Threading.ThreadPool.MinThreads"": 2,
""System.Threading.ThreadPool.MaxThreads"": 9,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,14 @@ public void StartupHookSupport_is_false_by_default_on_trimmed_apps(string target
runtimeConfig["runtimeOptions"]["configProperties"]
["System.StartupHookProvider.IsSupported"].Value<bool>()
.Should().Be(false);
runtimeConfig["runtimeOptions"]["configProperties"]
["System.Resources.ResourceManager.AllowCustomResourceTypes"].Value<bool>()
.Should().Be(false);
}
else
{
runtimeConfigContents.Should().NotContain("System.StartupHookProvider.IsSupported");
runtimeConfigContents.Should().NotContain("System.Resources.ResourceManager.AllowCustomResourceTypes");
}
}

Expand Down