From e872afcc9184a0c74e15f23cd798cf337d91aa4b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 30 Jul 2020 12:35:09 -0500 Subject: [PATCH] Fix ILLink.Substitutions.xml Warnings during Blazor build (#40051) * Fix ILLink warning for System.Runtime.Serialization.Formatters LocalAppContextSwitches is getting trimmed from the Browser specific assembly since it is unused. However, we still have an ILLink.Substitutions.xml file referencing it, causing the warning. The fix is to only include the ILLink.Substitutions.xml file for the non-Browser build. * Fix ILLink warning in System.Runtime.InteropServices.JavaScript When building for Browser, the Runtime.InteropServices.JavaScript assembly doesn't use the System.SR type which causes the ILLinker to trim it during the dotnet/runtme build. But since System.SR is used for the AnyOS build we are generating an ILLink.Substitutions.xml file telling the linker to remove the System.SR type. This causes a warning during the Blazor app build because the Type doesn't exist in the assembly, but the XML file references it. The fix is to not create an System.SR Type, nor embed the resources file, for the Browser build. This will need to be undone once a string is used in the Browser build. --- .../System.Runtime.InteropServices.JavaScript.csproj | 5 +++++ ...tions.xml => ILLink.Substitutions.NonBrowser.xml} | 0 .../System.Runtime.Serialization.Formatters.csproj | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) rename src/libraries/System.Runtime.Serialization.Formatters/src/ILLink/{ILLink.Substitutions.xml => ILLink.Substitutions.NonBrowser.xml} (100%) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj index c5455ea..072a1f1 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj @@ -8,6 +8,11 @@ SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported + + + true + false + diff --git a/src/libraries/System.Runtime.Serialization.Formatters/src/ILLink/ILLink.Substitutions.xml b/src/libraries/System.Runtime.Serialization.Formatters/src/ILLink/ILLink.Substitutions.NonBrowser.xml similarity index 100% rename from src/libraries/System.Runtime.Serialization.Formatters/src/ILLink/ILLink.Substitutions.xml rename to src/libraries/System.Runtime.Serialization.Formatters/src/ILLink/ILLink.Substitutions.NonBrowser.xml diff --git a/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj b/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj index 124a497..6d339f8 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj +++ b/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj @@ -9,8 +9,8 @@ $(MSBuildThisFileDirectory)ILLink\ - - + + @@ -21,10 +21,6 @@ - - - Common\System\LocalAppContextSwitches.Common.cs - @@ -59,8 +55,6 @@ - - @@ -73,6 +67,16 @@ + + + + + Common\System\LocalAppContextSwitches.Common.cs + + + + + -- 2.7.4