diff --git a/eng/ILLink.Substitutions.Resources.template b/eng/ILLink.Substitutions.Resources.template new file mode 100644 index 00000000000000..9381443ba3915b --- /dev/null +++ b/eng/ILLink.Substitutions.Resources.template @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/eng/illink.targets b/eng/illink.targets index 082d7e85c589ac..fc38a10979f854 100644 --- a/eng/illink.targets +++ b/eng/illink.targets @@ -40,7 +40,6 @@ $(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xml $(IntermediateOutputPath)ILLink.Descriptors.xml - $(MSBuildProjectDirectory)/ILLink.Substitutions.xml $(IntermediateOutputPath)ILLink.Substitutions.xml @@ -49,7 +48,6 @@ - @@ -105,8 +103,41 @@ + + $(IntermediateOutputPath)ILLink.Resources.Substitutions.xml + true + + + + + + + + + + + $(MSBuildThisFileDirectory)ILLink.Substitutions.Resources.template + + + + + + + + + diff --git a/eng/testing/linker/project.csproj.template b/eng/testing/linker/project.csproj.template index 75c4bd26d5731c..ef63096e8019c0 100644 --- a/eng/testing/linker/project.csproj.template +++ b/eng/testing/linker/project.csproj.template @@ -6,6 +6,7 @@ {RuntimeIdentifier} {RuntimePackDir} {TargetingPackDir} + <_ExtraTrimmerArgs>{ExtraTrimmerArgs} $(_ExtraTrimmerArgs) /p:DebugType=Embedded + + + --feature System.Resources.UseSystemResourceKeys true + diff --git a/src/libraries/System.Runtime/tests/TrimmingTests/VerifyResourcesGetTrimmedTest.cs b/src/libraries/System.Runtime/tests/TrimmingTests/VerifyResourcesGetTrimmedTest.cs new file mode 100644 index 00000000000000..fd486aab4c9782 --- /dev/null +++ b/src/libraries/System.Runtime/tests/TrimmingTests/VerifyResourcesGetTrimmedTest.cs @@ -0,0 +1,27 @@ +using System; + +class Program +{ + static int Main(string[] args) + { + try + { + throw new AggregateException(); + } + catch (Exception e) + { + // When the Trimmer recieves the feature switch to use resource keys then exception + // messages shouldn't return the exception message resource, but instead the resource + // key. This test is passing in the feature switch so we make sure that the resources + // got trimmed correctly. + if (e.Message == "AggregateException_ctor_DefaultMessage") + { + return 100; + } + else + { + return -1; + } + } + } +} \ No newline at end of file diff --git a/src/libraries/System.Threading.Channels/src/System.Threading.Channels.csproj b/src/libraries/System.Threading.Channels/src/System.Threading.Channels.csproj index 998a54c36e3562..f3adbd227e09db 100644 --- a/src/libraries/System.Threading.Channels/src/System.Threading.Channels.csproj +++ b/src/libraries/System.Threading.Channels/src/System.Threading.Channels.csproj @@ -31,6 +31,7 @@ Link="Common\System\Collections\Concurrent\SingleProducerConsumerQueue.cs" /> +