Despite what people are saying on the net, you do not need to write your own method to include milliseconds when formatting DateTime object. To achieve this, you can use “f”. For example, if you want to include thousands of a second (i.e. milliseconds), you can write something like this [...]
This appears to be a known bug in Visual Studio. I encountered it when my VS 2008 SP1 was idle for a considerable amount of time, hanging minimized in the task bar. Standard close/reopen VS did not help. There were no strange processes in Task Manager either. After some failed commands (same error), I found a workaround for this issue.