tag:blogger.com,1999:blog-36201586.post3244906365796555545..comments2023-01-05T21:58:34.019+00:00Comments on Derek says:: .NET Performance Counter ProblemsDerek Fowlerhttp://www.blogger.com/profile/09963865123124577525noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-36201586.post-51885707176091038842016-11-04T00:54:21.547+00:002016-11-04T00:54:21.547+00:00Overall, the PerformanceCounter(s) are created, bu...Overall, the PerformanceCounter(s) are created, but certain properties fail, such as CounterHelp. I also get exceptions like this:<br /><br />- base {System.InvalidOperationException: Counter 39dcd46cfa3649acac2cad0e427691d1 does not exist.<br /> at System.Diagnostics.PerformanceCounterLib.GetCounterHelp(String category, String counter, Boolean& categoryExists)<br /> at System.Diagnostics.PerformanceCounterLib.GetCounterHelp(String machine, String category, String counter)<br /> at System.Diagnostics.PerformanceCounter.get_CounterHelp()} System.Exception {System.InvalidOperationException}<br />+ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}<br /> HelpLink null string<br /> HResult -2146233079 int<br />+ InnerException null System.Exception<br /> Message "Counter 39dcd46cfa3649acac2cad0e427691d1 does not exist." string<br /> Source "System" string<br /> StackTrace " at System.Diagnostics.PerformanceCounterLib.GetCounterHelp(String category, String counter, Boolean& categoryExists)\r\n at System.Diagnostics.PerformanceCounterLib.GetCounterHelp(String machine, String category, String counter)\r\n at System.Diagnostics.PerformanceCounter.get_CounterHelp()" string<br />+ TargetSite {System.String GetCounterHelp(System.String, System.String, Boolean ByRef)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}<br />+ Static members <br />+ Non-Public members <br />Anonymoushttps://www.blogger.com/profile/10548733485844234655noreply@blogger.comtag:blogger.com,1999:blog-36201586.post-29812538058984174172016-11-04T00:48:06.698+00:002016-11-04T00:48:06.698+00:00Posted in 2007. Yikes. I'm not sure it's g...Posted in 2007. Yikes. I'm not sure it's gotten any better. Performance Counters has been giving me fits for a couple solid couple of days now. And here I thought I might be the only one. Heavens no. I can create a category just fine. But when I turn around to work with "new" PerformanceCounters associated with the category, with known names (via the CounterCreationData), I get all sorts of errors like Counter does not exist:<br /><br />Xunit.Sdk.AllException<br />Assert.All() Failure: 4 out of 4 items in the collection did not pass.<br />[3]: System.InvalidOperationException: Counter c52de162309844e490b8d63acecde8b1 does not exist.<br /><br />That's progress, I think; earlier it was that the counter in the category did not exist. That's a difference of using different constructors and/or initializer lists from the PerformanceCounter perspective. Even that is problematic.<br /><br />I am also not sure this has to do with OS version; I am developing on a Windows 7 Professional 64-bit.Anonymoushttps://www.blogger.com/profile/10548733485844234655noreply@blogger.comtag:blogger.com,1999:blog-36201586.post-9102267077471976972016-03-16T22:27:23.542+00:002016-03-16T22:27:23.542+00:00Years later (Mar 2016) this post explained why Per...Years later (Mar 2016) this post explained why PerformanceCounterCategory.Exists("MyCategory") worked the first time but then didn't change as I created/deleted the category.Toshnoreply@blogger.comtag:blogger.com,1999:blog-36201586.post-15123369582789438272012-07-20T07:31:53.607+01:002012-07-20T07:31:53.607+01:00Great post. I was experiencing same scenario where...Great post. I was experiencing same scenario where CounterExists was throwing an exception and once it starts all subsequent calls to the same throws the same exception. I tried PerformanceCounter.Dispose but did not help. I overlooked the method msdn doc multiple times. This posrt came as rescu and great relief. Thanks a tonAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-36201586.post-39534482428649125972012-07-19T12:45:50.214+01:002012-07-19T12:45:50.214+01:00Very informative - found it via topic "Custom...Very informative - found it via topic "Custom Performance Counter Updates the Wrong Counter" in the MSDN forums.<br /><br />However the PerformanceCounter.ClosedSharedResources() did not solve it for me - only a reboot of the server did it, after half a day of tracing/debugging trying to figure out why my new performance-counter's value appeared in a previously created performance-counter.D.noreply@blogger.comtag:blogger.com,1999:blog-36201586.post-6783220127456384452011-05-12T14:45:16.360+01:002011-05-12T14:45:16.360+01:00Thanks a lot for this Blog ...
This is exactly wha...Thanks a lot for this Blog ...<br />This is exactly what I was looking forAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-36201586.post-59330951759834521512008-06-10T11:18:00.000+01:002008-06-10T11:18:00.000+01:00Thanks, this helped meThanks, this helped meAnonymousnoreply@blogger.com