From 2fe5ac2b9a1de1d8ba9c204e4589c3697aebb686 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sat, 10 Jul 2021 10:26:12 -0400 Subject: [PATCH] Fix erroneous "globalizationMode" local naming in PlatformDetection --- .../tests/TestUtilities/System/PlatformDetection.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 5038c4f01977ef..0bd29858a16927 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -242,14 +242,9 @@ public static string GetDistroVersionString() private static bool GetStaticNonPublicBooleanPropertyValue(string typeName, string propertyName) { - Type globalizationMode = Type.GetType(typeName); - if (globalizationMode != null) + if (Type.GetType(typeName)?.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Static)?.GetMethod is MethodInfo mi) { - MethodInfo methodInfo = globalizationMode.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Static)?.GetMethod; - if (methodInfo != null) - { - return (bool)methodInfo.Invoke(null, null); - } + return (bool)mi.Invoke(null, null); } return false;