Skip to content

Commit

Permalink
Update SDK to support new DI and Attribute feature switches (#19432)
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt committed Jul 31, 2021
1 parent b5b2072 commit e10860e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Assets/TestProjects/KitchenSink/TestApp/TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<!-- Host configuration properties
Keep this list in the same order as the configProperties in GivenThatWeWantToPublishAProjectWithAllFeatures. -->
<PropertyGroup>
<VerifyDependencyInjectionOpenGenericServiceTrimmability>true</VerifyDependencyInjectionOpenGenericServiceTrimmability>
<_AggressiveAttributeTrimming>true</_AggressiveAttributeTrimming>
<EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>false</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
<DebuggerSupport>true</DebuggerSupport>
<EventSourceSupport>false</EventSourceSupport>
Expand All @@ -20,6 +22,7 @@
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
<UseNativeHttpHandler>true</UseNativeHttpHandler>
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
<NullabilityInfoContextSupport>false</NullabilityInfoContextSupport>
<CustomResourceTypesSupport>false</CustomResourceTypesSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<BuiltInComInteropSupport>false</BuiltInComInteropSupport>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">true</UseSystemResourceKeys>
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">false</NullabilityInfoContextSupport>
<_AggressiveAttributeTrimming Condition="'$(_AggressiveAttributeTrimming)' == ''">true</_AggressiveAttributeTrimming>
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' != 'Debug'">false</DebuggerSupport>
<BlazorCacheBootResources Condition="'$(BlazorCacheBootResources)' == ''">true</BlazorCacheBootResources>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<AutoreleasePoolSupport Condition="'$(AutoreleasePoolSupport)' == ''">false</AutoreleasePoolSupport>
<EnableCppCLIHostActivation Condition="'$(EnableCppCLIHostActivation)' == ''">false</EnableCppCLIHostActivation>
<_EnableConsumingManagedCodeFromNativeHosting Condition="'$(_EnableConsumingManagedCodeFromNativeHosting)' == ''">false</_EnableConsumingManagedCodeFromNativeHosting>
<VerifyDependencyInjectionOpenGenericServiceTrimmability Condition="'$(VerifyDependencyInjectionOpenGenericServiceTrimmability)' == ''">true</VerifyDependencyInjectionOpenGenericServiceTrimmability>
</PropertyGroup>

<PropertyGroup Condition="'$(SuppressTrimAnalysisWarnings)' == '' And ('$(EnableTrimAnalyzer)' == 'true' Or '$(PublishTrimmed)' == 'true')">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ Copyright (c) .NET Foundation. All rights reserved.
-->

<ItemGroup>
<RuntimeHostConfigurationOption Include="Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability"
Condition="'$(VerifyDependencyInjectionOpenGenericServiceTrimmability)' != ''"
Value="$(VerifyDependencyInjectionOpenGenericServiceTrimmability)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.AggressiveAttributeTrimming"
Condition="'$(_AggressiveAttributeTrimming)' != ''"
Value="$(_AggressiveAttributeTrimming)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization"
Condition="'$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)' != ''"
Value="$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)"
Expand Down Expand Up @@ -424,6 +434,11 @@ Copyright (c) .NET Foundation. All rights reserved.
Value="$(MetadataUpdaterSupport)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Reflection.NullabilityInfoContext.IsSupported"
Condition="'$(NullabilityInfoContextSupport)' != ''"
Value="$(NullabilityInfoContextSupport)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Resources.ResourceManager.AllowCustomResourceTypes"
Condition="'$(CustomResourceTypesSupport)' != ''"
Value="$(CustomResourceTypesSupport)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public void It_publishes_the_project_correctly(string targetFramework, string []
var baselineConfigJsonObject = JObject.Parse(@"{
""runtimeOptions"": {
""configProperties"": {
""Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability"": true,
""System.AggressiveAttributeTrimming"": true,
""System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization"": false,
""System.Diagnostics.Debugger.IsSupported"": true,
""System.Diagnostics.Tracing.EventSource.IsSupported"": false,
Expand All @@ -78,6 +80,7 @@ public void It_publishes_the_project_correctly(string targetFramework, string []
""System.Net.Http.EnableActivityPropagation"": false,
""System.Net.Http.UseNativeHttpHandler"": true,
""System.Reflection.Metadata.MetadataUpdater.IsSupported"": false,
""System.Reflection.NullabilityInfoContext.IsSupported"": false,
""System.Resources.ResourceManager.AllowCustomResourceTypes"": false,
""System.Resources.UseSystemResourceKeys"": true,
""System.Runtime.InteropServices.BuiltInComInterop.IsSupported"": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
{
JObject runtimeConfig = JObject.Parse(runtimeConfigContents);
JToken configProperties = runtimeConfig["runtimeOptions"]["configProperties"];
configProperties["Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability"].Value<bool>()
.Should().BeTrue();
configProperties["System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization"].Value<bool>()
.Should().BeFalse();
configProperties["System.Resources.ResourceManager.AllowCustomResourceTypes"].Value<bool>()
Expand All @@ -701,6 +703,7 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
}
else
{
runtimeConfigContents.Should().NotContain("Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability");
runtimeConfigContents.Should().NotContain("System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization");
runtimeConfigContents.Should().NotContain("System.Resources.ResourceManager.AllowCustomResourceTypes");
runtimeConfigContents.Should().NotContain("System.Runtime.InteropServices.BuiltInComInterop.IsSupported");
Expand Down

0 comments on commit e10860e

Please sign in to comment.