Using Visual C# 2010 Express, when I throw an exception it takes about minute and a half for the debugger to break on a user unhandled exception. During this time the application I'm debugging and visual studio are completely unresponsive and VCSExpress.exe
processor usage jumps to 12-14%. The rest of the computer (mouse, other applications, etc.) remains responsive.
Visual studio isn't completely unusable but it is definitely slowing my application down when running from the debugger. I haven't been able to find the real source of the slowdown yet. This happens right at startup and isn't a problem that gets worse over time.
I have disabled my antivirus (eset nod32 v7) and do not have any extensions installed. My CPU is an Intel Core i7 740QM @ 1.73GHz (quad-core hyperthreaded). OS is Windows 7 Professional. I've updated Visual C# 2010 Express to SP1 (Version 10.0.40219.1 SP1Rel). My hard disk shows no warning signs via S.M.A.R.T.
I have two extremely simple test scenarios written in WPF. In the first scneario I simply throw an exception when the button is clicked:
private void button1_Click(object sender, RoutedEventArgs e)
{
throw new InvalidOperationException();
}
I manually measured the time between when I click the button and when Visual Studio displays the thrown/user unhandled exception dialogue box (and thus becomes responsive again). I tested the timing for breaking on thrown versus user-unhandled exceptions when, with and without antivirus (AV), and with and without the Visual Studio Hosting Process (VS):
Debug, Unhandled, AV on -- 1:35.3, 1:38.0
Debug, Thrown, AV on -- 0:10.4, 0:11.5, 0:11.1
Debug, Thrown, AV off -- 0:10.7
Release, Thrown, AV off -- 0:9.1, 0:10.0
Release, Unhandled, AV off -- 1:34.5
Release, Thrown, AV off, No VS Hosting -- 0:8.9, 0:9.1
Release, Unhandled, AV off, No VS Hosting -- 1:19.6, 1:20.9
When breaking on unhandled exceptions, it takes 1:30 (1 minute, 30 seconds) to recover. Antivirus makes no difference. Taking away VS Hosting saves around 15 seconds. Release mode saves about 1 second. Switching to breaking on thrown exceptions has significant savings (10 seconds to recover), though this still is not acceptable.
My second test scenario is for timing a caught exception inside and outside of Visual Studio:
private void button2_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Stopwatch sw = new Stopwatch();
sw.Start();
try
{
throw new InvalidOperationException();
}
catch { }
sw.Stop();
label1.Content = string.Format("{0:0.000} seconds", sw.ElapsedMilliseconds / 1000.0);
}
For this scenario, I set VS to break only on unhandled exceptions so I could get timing data for simple caught exceptions. I ran this in VS and outside of VS as the stand-alone EXE:
Release, Unhandled, AV off, No VS Hosting -- 0:1.965, 0:1.812, 0:1.985
Debug, Unhandled, AV off, No VS Hosting -- 0:2.333, 0:2.136, 0:2.305
Release EXE, AV off -- 0:0.002, 0:0.000, 0:0.000
Debug EXE, AV off -- 0:0.002, 0:0.000, 0:0.000
Outside of VS there is no slowdown. Inside of VS this takes about 2 seconds, which still seems pretty excessive for a quad core hyperthreaded CPU and a tiny try/catch block.
I'm pursuing some of the leads in the linked questions (system environment settings, etc.) and monitoring the file system/disk activity to see if I can get any leads. Any additional help is much appreciated!
btw, I'd prefer not to re-install Visual Studio or my OS
Thanks!
Update I've installed VS 2012 Express, and the numbers are:
Test 1:
Debug, Unhandled, AV off -- 0:01.6
Debug, Thrown, AV off -- 0:01.1
Test 2:
Debug, VS Hosting -- 0:1.202
Debug, No VS Hosting -- 0:1.191
Release, VS Hosting -- 0:1.220
The numbers in VS2012 are much better. Clearly one solution to my problem is upgrading to VS2012, which is what I'm planning on doing. But I'd still like a resolution to this problem if anyone has any ideas.