I have performance counters group and some performance counters.
If I then quit the performance monitor and restarted it the last counter value in the test program would be shown, indicating that it was being set correctly.
If I then ran the test program again, just changing values, performance monitor would finally pick up the changes.
So the code, as everyone indicated is correct, it was the Windows Performance monitor that was misbehaving. Is it possible in the course of your testing that you changed the counter name?
Your code doesn't verify that the category contains your counter - it only checks if the category exists, and if it does, it doesn't create the category.