I got the error "Input string was not in a correct format" in a log file in one of our programs while testing it on a Windows Server 2003 virtual machine. One of my coworkers pointed out the error "Input string was not in a correct format" was coming from the performance counters, which weren't trying to pass an input string in an incorrect format.
A search on the net showed a page where this error comes up when the performance counters are corrupt. I opened the Performance Monitors (perfmon from run) and it didn't start up with the 3 basic counters: pages/sec, % processor time, Avg. disc Queue length. When I tried to add new counters they all came up as a bunch of numbers. See below.
After verifying this was the problem I fixed the problem using the command: c:\windows\system32\lodctr /R
When I reloaded the performance counters, everything worked fine. Here is the article from Microsoft.