Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Work around occasional IOException using OpenRemoteBaseKey against local machine #29009

Merged
merged 1 commit into from
Apr 17, 2018
Merged

Conversation

Anipik
Copy link

@Anipik Anipik commented Apr 11, 2018

RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, ".") " is sporadically hitting an IOException with "Network path not found" because the underlying call to RegConnectRegistry is returning an error. I am working around the problem by using Registry.LocalMachine when the key requested is against the local machine. I will open the issue to consider whether OpenRemoteBaseKey should do this itself. I will tag the issue here (after I create it)
Fixes https://github.com/dotnet/corefx/issues/29007

@@ -236,7 +236,7 @@ private static void LoadPerfCounterDll()

string installPath = SharedUtils.GetLatestBuildDllDirectory(".");

string perfcounterPath = Path.Combine(installPath, "perfcounter.dll");
string perfcounterPath = Path.Combine(installPath, "perfcounter.dll".ToLowerInvariant());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this fix this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I repro the bug is. Build my corefx repo and the test project. Copy the bin folder to the Spanish machine. and run the tests using Xunit.
The reason for the failure could be that the string "perfcounter.dll" is stored somewhat differently on the Spanish machine. I will investigate more and update why and how it is fixing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little surprised at this as well. I was wondering where the incorrectly localized string was that caused this, but I don't see one so far. Do you know why machine name "." is OK on English, but not on non-English?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the descrption with more investigation results

@stephentoub stephentoub modified the milestones: Future, 2.2.0 Apr 11, 2018
@Anipik
Copy link
Author

Anipik commented Apr 11, 2018

This is how we are handling this in eventlog

 if (machineName == ".")
    baseKey = Registry.LocalMachine;
 else
   baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName);

and we does a similar thing in corefx

@Anipik
Copy link
Author

Anipik commented Apr 12, 2018

@JeremyKuhne this test failed on OSX https://mc.dot.net/#/user/Anipik/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/4905f366c2d37e7669a9022c021f3b370278c463/workItem/System.Buffers.Tests/analysis/xunit/System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests~2FRentBufferFiresRentedDiagnosticEvent

Unhandled Exception of Type Xunit.Sdk.EqualException
Message :
Assert.Equal() Failure
Expected: 1
Actual:   2
Stack Trace :
   at System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentBufferFiresRentedDiagnosticEvent() in /Users/dotnet-bot/j/workspace/dotnet_corefx/master/osx-TGroup_netcoreapp+CGroup_Debug+AGroup_x64+TestOuter_false_prtest/src/System.Buffers/tests/ArrayPool/UnitTests.cs:line 424

@JeremyKuhne
Copy link
Member

this test failed on OSX

@Anipik from when you kicked this I'm not sure that it got the fix. Let me know if you see it again.

@Anipik
Copy link
Author

Anipik commented Apr 17, 2018

@dotnet-bot test Outerloop Windows x64 Release Build
@dotnet-bot test Outerloop Windows x64 Debug Build

@Anipik
Copy link
Author

Anipik commented Apr 17, 2018

@dotnet-bot test Windows x64 Debug Build
@dotnet-bot test Windows x86 Release Build

@Anipik Anipik changed the title sampleCounter test passed on CI Work around occasional IOException using OpenRemoteBaseKey against local machine Apr 17, 2018
@Anipik Anipik merged commit 15e0c95 into dotnet:master Apr 17, 2018
@Anipik Anipik deleted the sampleCount branch April 17, 2018 20:59
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants