How do I stop custom performance counter instance names from being auto converted to lower case
c#, performance
Solution
I used Reflector to look at the code in System.dll for the PerformanceCounter. In the private Initialize event is this little nugget:
this.sharedCounter = new SharedPerformanceCounter(categoryName.ToLower(CultureInfo.InvariantCulture), this.counterName.ToLower(CultureInfo.InvariantCulture), this.instanceName.ToLower(CultureInfo.InvariantCulture), this.instanceLifetime);
I think that's why.
Problem
I have created a multi-instance performance counter and I pass it mixed case instance names but somehow the instance names get converted to lower case when I view them both through code and in perfmon. Does anyone know how to prevent this? Found this on google, thought it was nice of Luke Zhang to never follow up.