Comments
8 comments
-
Hi Jeff,
Thanks for reporting this, and sorry for the hassle. It looks like there is a bug in the .NET FCL here, however I think we might try to handle it slightly more gracefully!
Cheers,
Bart -
Hi again Jeff,
So handling this exception isn't a problem for us at all, however I wanted to know what was actually causing it because our fix will still mean that you won't see any data for this counter, or any others affected by this problem. I dug through the IL using Exception Hunter and found the line that was causing the problem easily enough, however it wasn't really illuminating so I did a web search and came up with this:
http://forums.msdn.microsoft.com/en-US/ ... 4c723f572/
The response here is that the performance counter information on your machine has become corrupted, so (somehow) you'll need to sort that out if you want to see any information for the performance counter. I'd suggest running PerfMon since this does seem to fix some problems with incorrectly published performance counters, but I wouldn't guarantee it.
Hope that helps. We'll get the exception handler in for the release candidate.
Thanks,
Bart -
Hi Jeff,
In the meantime you might also want to take a look at this
http://dotnet.org.za/ahmeds/archive/200 ... 44562.aspx
which suggests using the lodctr command from a command prompt. The lodctr /r command only works on Windows Server 2003; with XP (and presumably Vista), it appears you need to give it a file to restore performance counter settings.
Lodctr is documented here:
http://technet.microsoft.com/en-us/libr ... 55887.aspx
Hope that helps,
Thanks,
Bart -
It looks like this stops the "Launching..." process, so I can't use the profiler at all with it happening.
I have seen this sort of problem before, and understand about performance counter corruption. I wonder if you have any way to dig out any more info about exactly which counter may be corrupted?
Or, I can write some code myself to dig into it, maybe?
Thanks,
Jeff -
Hi Jeff,
Probably the easiest way to do this is going to be switching off all of the performance counters you can (The process % CPU is required) in the performance counter tab of the startup wizard. You can then re-add them in batches to find which is corrupted.
We use the .NET standard BCL functions to access the performance counters (System.Diagnostics.PerformanceCounter) so I will see if I can create a little dianostics app for you in a bit.
Regards,
James -
Hi Jeff,
I'm planning to write the error information out to the log file, with an entry for every counter for which the problem occurs, so then you'll be able to see which counters are failing.
One thing you might try doing is deselecting all the performance counters in the setup dialog before you run the profiler (they're on the second tab). You won't be able to disable the "% CPU (Process)" counter, but then if that doesn't work well... you're a bit stuck for now, although it might be worth seeing if you can monitor this for a process in PerfMon, and then if so, re-run ANTS Profiler.
You could also try writing some .NET code that creates instances of the PerformanceCounter class (in System.Diagnostics) for the counters you're interested in to see which ones cause the exception to occur. Bear in mind that for ANTS Profiler, many of the counters are instanced, i.e., associated with a particular process, so you'll need to run a process for which you want to grab these counters as well.
We'll make sure our fix is in for the RC which, all being well, should be available some time on Monday 18th August.
Thanks,
Bart -
Even if I turn off all counters that I can, the problem still occurs. As I look at the registry, it looks like things are completely screwed up. There's a huge chunk of empty entries in both the 'Counter' and 'Help' values in my Perflib registry key.
I tried using lodctr with the perfstringbackup.ini file, but that didn't help. Perfmon also is affected, showing all numbers (no names) for the various counters.
Clearly I need to get this fixed.
As far as ANTS is concerned, I think you guys need to find a way to gracefully handle this type of corruption, and allow profiling to succeed, even without the counters being monitored. Or -- does the inability to get this information make it impossible for it to do its job?
Thanks,
Jeff -
Hi Jeff,
I'd love to be able to say I'm entirely shocked that things could become that screwed up, but over time I've come to accept the face that performance counters, and the APIs used to access them, are extremely fragile. I am slightly surprised by this, but not as much as you might expect.
Now, the performance counters functionality is fairly core to the way the ANTS Profiler UI works, though not to the profiling engine as such, so I think whilst I can say that we'll handle the exception more gracefully than simply falling over, as seems to be the case at the moment, given the late stage of the project, and the other work we have still outstanding, I think it would be entirely wrong of me to promise anything more than that for the 4.0 release. That's not to say that it definitely won't work, but I certainly can't promise that it will, and it may be that we have to push it back to a patch release at a later date.
As I said, I'm not really shocked by this, but it is unanticipated, and we hadn't envisaged encountering a problem like this so late in the day, partcularly after such an extensive early access programme. The best thing I can suggest for now is that you attempt to fix your machine's performance counter configuration.
You don't say which OS version you're using, but you may find the following helpful (applies to Windows 2000 through 2003 server):
http://support.microsoft.com/kb/300956
There's also some additional information in this thread that may prove to be useful:
http://channel9.msdn.com/forums/TechOff ... corrupted/
Hope that helps.
Thanks,
Bart
Add comment
Please sign in to leave a comment.
Just loaded up the Beta, and ran it against our big mixed-mode app. During startup of the app, it popped up this error. Of course it's not specific about what string it's working with.
Thought you'd like to know.
- Jeff
Input string was not in a correct format.
System.FormatException
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, IFormatProvider provider)
at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
at System.Diagnostics.PerformanceCounterLib.get_NameTable()
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists)
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
at RedGate.Profiler.Monitoring.PerformanceCounterFactory.CreateInstancedPerformanceCounter(String categoryName, String counterName, Int32 processID, String instanceName)
at RedGate.Profiler.Monitoring.PerformanceCounterFactory.CreatePerformanceDataAdapter(String instanceName, PerformanceCounterInfo info, Int32 processID, PerformanceCounterLog log, UpdateTimer timer)
at RedGate.Profiler.Session.SessionPerformanceCounterData.StartProfiling(Int32 processID)
at RedGate.Profiler.Session.ProfilerSession.k()
at RedGate.Profiler.Session.ProfilerSession.a(Object , ConnectedEventArgs )
at bn.OnConnected(ConnectedEventArgs e)
at bn.RedGate.Profiler.Engine.Startup.IInternalSessionStarter.OnConnected(g newLog)
at aW.c(aU , aX )
at aW.a(aU , aX )