From 88e0428caa33fd04bd8f5f8bc1a60b6a44b93622 Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed Date: Thu, 29 Jun 2017 12:32:30 -0700 Subject: [PATCH] Make ResourceManager netstandard 2.0 API behave correctly (#12536) * Make ResourceManager netstandard 2.0 API behave correctly In netstandard 2.0 we have enabled the APIs like GetObject, GetStream,..etc. these are not functioning correctly in UWP apps because was assuming we always uses PRI files. The changes here is to initialize the managed resources too and let these APIs behave as if we are running inside desktop app. * added #ifdef * Remove the throwing as PRI can handle case insenitive lookup * remove un-needed resources --- src/mscorlib/src/System/Resources/ResourceManager.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/mscorlib/src/System/Resources/ResourceManager.cs index 994aa8c..92b935d 100644 --- a/src/mscorlib/src/System/Resources/ResourceManager.cs +++ b/src/mscorlib/src/System/Resources/ResourceManager.cs @@ -438,18 +438,16 @@ namespace System.Resources // security check in each constructor prevents it. private void CommonAssemblyInit() { - if (_bUsingModernResourceManagement == false) - { - UseManifest = true; + // Now we can use the managed resources even when using PRI's to support the APIs GetObject, GetStream...etc. + UseManifest = true; - _resourceSets = new Dictionary(); - _lastUsedResourceCache = new CultureNameResourceSetPair(); + _resourceSets = new Dictionary(); + _lastUsedResourceCache = new CultureNameResourceSetPair(); - _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly; + _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly; - ResourceManagerMediator mediator = new ResourceManagerMediator(this); - resourceGroveler = new ManifestBasedResourceGroveler(mediator); - } + ResourceManagerMediator mediator = new ResourceManagerMediator(this); + resourceGroveler = new ManifestBasedResourceGroveler(mediator); _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc); } -- 2.7.4