Closed
Description
Inconsistently but frequently, PRs in CI have been failing tests from the System.Diagnostics.Tests.PerformanceCounterTests suite. When one test fails, a ton fail. They all look along the lines of this:
Error message
System.InvalidCastException : Unable to cast object of type 'System.String' to type 'System.String[]'.
Stack trace
at System.Diagnostics.SharedPerformanceCounter.GetCategoryData() in /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs:line 700
at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime) in /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs:line 96
at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName) in /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs:line 88
at System.Diagnostics.SharedPerformanceCounter.RemoveAllInstances(String categoryName) in /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs:line 1389
at System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName) in /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategory.cs:line 395
at System.Diagnostics.Tests.Helpers.DeleteCategory(String name) in /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs:line 46
at System.Diagnostics.Tests.Helpers.CreateCategory(String name, PerformanceCounterCategoryType categoryType) in /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs:line 22
at System.Diagnostics.Tests.PerformanceCounterTests.CreateCounterWithCategory(String name, Boolean readOnly, PerformanceCounterCategoryType categoryType) in /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs:line 293
at System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Decrement() in /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs:line 186