From: Vitek Karas Date: Mon, 24 Feb 2020 12:55:42 +0000 (-0800) Subject: Mark class ctors as preserved for dependencies of System.SR (#31718) X-Git-Tag: submit/tizen/20210909.063632~9537 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab2a67c7a4260db9fab1f5d66afe8a2e0a312d8a;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Mark class ctors as preserved for dependencies of System.SR (#31718) The System.SR.InternalGetResourceString calls RuntimeHelpers.RunClassConstructor on several classes. This is a dependency the ILLinker won't be able to figure out, so explicit PreserveDependency is needed. --- diff --git a/src/libraries/System.Private.CoreLib/src/System/SR.cs b/src/libraries/System.Private.CoreLib/src/System/SR.cs index a613ea8..fff60a9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SR.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SR.cs @@ -46,6 +46,7 @@ namespace System private static int _infinitelyRecursingCount; private static bool _resourceManagerInited = false; + [PreserveDependency(".cctor()", "System.Resources.ResourceManager")] private static string? InternalGetResourceString(string? key) { if (string.IsNullOrEmpty(key))