473,463 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PerformanceCounterCategory woes

Hello all,

This is a long post but I'd better provide all the details from the outset
to prevent cluttering the NGs with clarifications. I also apologize for
cross-posting, I am just not sure what area the root of the problem belongs
to.

So, I am currently trying to resolve a very puzzling problem with the
PerformanceCounterCategory class. Suppose we have the following code
snippet:

<codeSnippet>
bool ok = true;

if (!PerformanceCounterCategory.Exists("My category"))
{
ok = false;
}

if (ok && !PerformanceCounterCategory.CounterExists(
"Counter Name 1",
"My category"))
{
ok = false;
}

if (ok && !PerformanceCounterCategory.CounterExists(
"Counter Name 2",
"My category"))
{
ok = false;
}
</codeSnippet>

Most of the time, the code above works OK. Sometimes, however, it chokes on
the CounterExists method call - an InvalidOperationException is thrown with
Message saying "Category does not exist". The stack trace points to a
PerformanceCounterLib class which seems to be not documented.

It's strange, isn't it - the Exists method has just reported the category
*does* exist. Well, now the symptoms:

a) It is an ASP .NET application
b) The ASPNET user has been granted permissions to the appropriate registry
keys (WindowsNT\PerfLib and CurrentControlSet\Services), but still remains
in the group it has been added to by the installer.
c) If the machine is restarted (sometimes it is enough to restart IIS), the
problem usually goes away.
d) It is very hard to reproduce the problem. We have observed it for several
months, but still haven't figured out the pattern.

I have searched Google newsgroup archive, KB, MVP-level KB, the Web - but to
no avail. The only post I found on the Russian GotDotNet forum suggested to
swap the order of some lines in code, but this is hardly a reliable
solution.

Any help would be greatly appreciated.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Nov 15 '05 #1
0 1634

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mark | last post by:
O, woe is me, to have seen what I have seen, see what I see! (That's Shakespeare for those who were wondering what I'm on about) I am "having fun" with cookies. And I wonder if I have...
0
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade...
3
by: Angel Cat | last post by:
Trying to get my jobs to send mail when job fails. Should be easy but it's giving me headache Had a whole slew of issues. Outlook is installed with a n outlook mail profile set up that can...
2
by: Andrew Thompson | last post by:
- NN 4.78 rendering woes, links at far left - I am trying to rework an old site, make it valid html and css, improving the x-browser and 'older browser' compatibility. My efforts so far, have...
0
by: Arun Bhalla | last post by:
I'm having some inconsistency problems with my deployment project ("Setup") and its custom actions ("Installer"). I'm using Visual Studio .NET 2003 (.NET 1.1, no service pack) on Windows XPSP1. ...
0
by: Dmitriy Lapshin [C# / .NET MVP] | last post by:
Hello all, This is a long post but I'd better provide all the details from the outset to prevent cluttering the NGs with clarifications. I also apologize for cross-posting, I am just not sure...
9
by: Mark Rae | last post by:
Hi, This time, I'm looking for a regular expression which says "the string must contain exactly seven or exactly eight digits" e.g. 123456 fails 1234567 passes 12345678 passes 123456789...
0
by: DR | last post by:
PerformanceCounterCategory.Create() takes 3 minutes to add a new category!! If I run PerformanceCounterCategory.Create() on my development machine it only takes a few seconds. But on remotely...
0
by: DR | last post by:
PerformanceCounterCategory.Create() takes 3 minutes to add a new category!! How come? What can cause this?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.