diff --git a/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs b/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs index 9ddb161e0413..3d20b23b2dcc 100644 --- a/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs +++ b/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs @@ -163,7 +163,11 @@ internal static string GetLatestBuildDllDirectory(string machineName) try { - baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName); + if (machineName == ".") + baseKey = Registry.LocalMachine; + else + baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName); + if (baseKey == null) throw new InvalidOperationException(SR.Format(SR.RegKeyMissingShort, "HKEY_LOCAL_MACHINE", machineName));