views:

3625

answers:

11

Hello everyone,

In my Visual Studio, even I just wrote a single line of return in a C# console application, it will take me a minute after pressing F5 to execute the actual code (I mean the time it takes to stop on the single return statement after pressing F5 -- I set a breakpoint on return statement in Main function). I am wondering what is wrong? Any check list? Thanks!

I am using Visual Studio 2008 VSTS edition and debugging on Windows Server 2003 x64.

thanks in advance, George

+1  A: 

Do you have a lot of breakpoints set? Those can really slow down startup time. Everytime a new module is loaded into the process address space, they all need to be checked to see if they are valid.

1800 INFORMATION
I only have one break point in my user mode code. But I remembered a week before I used source debugging feature in Visual Studio to set some break point into .Net internal code. Any way to check all break points including .Net internal ones I set?
George2
check the breakpoints window
1800 INFORMATION
None, but still slow, any further ideas?
George2
not really, it seems like your hardware should be ok and all the other items I would have tried seem to have been ticked off by other commenters. At this point I would probably try reinstalling visual studio - maybe something is messed up with the install
1800 INFORMATION
I reinstalled to another directory but stil the same symptom. Any further ideas?
George2
+1  A: 

I have seen this before. Try deleting all your breakpoints and then set the ones you want. Hit F5. Is it faster now?

I just noticed that you mentioned setting up .NET source debugging feature. Try to disable that, your network connectivity to Microsoft's source server may be slow. Also disable any symbol server connectivity in Tools > Options > Debugging > Symbols

Also try disabling "Enable property evaluation and other implicit function calls" in Tools > Options > Debugging > General.

m-sharp
In my break points window, there is only one on the return statement of my Main function. Any other check lists?
George2
Hmmm...Did you try deleting that one breakpoint and hit F5?
m-sharp
Added more things to try. Hope it helps.
m-sharp
I have removed the only one break point on return statement of my Main function, but still very slow to start the application and stop, takes 1 minute or so. Any further ideas?
George2
Here's another idea to isolate your problem. Try disconnecting your network cable, restart visual studio and hit F5 on your project. Does that change anything?
m-sharp
Hi m-sharp, without network cable, the debugging is very fast. Any hints what is going on with VSTS on the network connection?
George2
Cool! Reconnect your network and use tcpview http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx to see what connections devenv.exe is making to the outside world. These connections may be slow and are slowing your debugging.
m-sharp
A: 

Get more memory and a faster HD. More details here.

Travis
I do not think it is H/W issue, since my hardware is 4G memory + 2 CPU (2.33G), is that enough?BTW: I did not suffer from this a week before, so I think it should be some configuration issues?
George2
A: 

From ScottGu's blog linked by Travis: "One other performance gotcha I've heard about recently is an issue that a few people have reported running into with the Google Toolbar add-in. For some reason this can sometimes cause long delays when attaching the Visual Studio debugger to the browser. If you are seeing long delays with your web application loading, and have the Google Toolbar (or other toolbars) installed, you might want to try uninstalling them to see if that is the cause of the issue."

Cat
Do you have Google Toolbar installed? Even saying no is helpful for future readers of this question.
Cat
I opened IE and no toolbar displayed, does it mean I have no toolbar installed and will not impact Visual Studio? :-)
George2
+1  A: 

Make sure you don't have any stale network mappings to servers that no longer exist (network timeouts will kill you). Or use something like Process Monitor to see if a network (or other file error) seems to be blocking for a long time.

Michael Burr
Process Monitor is a cool tool! :-)But which option in Process Monitor could be used to see "if a network (or other file error) seems to be blocking for a long time"?
George2
I would look for things such as errors when attempting to open a file or how long operations take (don't forget there are data items you might not seen such as 'Duration' that you can select in Options/Select Columns...). Use the filters and highlights to your advantage.
Michael Burr
Hi Michael Burr, in Process Monitor you mean monitor VSTS process itself or monitor all processes on the machine?
George2
I'd definitely start with just VSTS (devenv.exe) or you'll get inundated with information that's almost certainly not useful.
Michael Burr
Sorry, you mean start VSTS from command line?
George2
No - the name of the VS process is devenv.exe (whether you start it from the command line or not), so devenv.exe is what will show up in Process Monitor.
Michael Burr
Thanks Michael Burr, I am ready to use Process Explorer to debug this issue. But there is no Select Columns option under "Options" menu. I am using Process Explorer 11.20. Any ideas?
George2
You'll want to use "Process Monitor" not "Process Explorer". See http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx. The 2 utilities have different functions. Procmon will trace file and registry operations. Procexp is a handy utility but does not provide that type of tracing.
Michael Burr
A: 

Are you using a Symbol Server to download symbols for Windows DLL's?

If so disable that as it can take some time but I wouldn't expect that to cause long delays in a basic console app.

Tools > Options > Debugging > Symbols

Michael Prewecki
The content is empty in Tools > Options > Debugging > Symbols. Any further ideas?
George2
+5  A: 

You may need to delete all your breakpoints---note that you need to click the "delete all breakpoints" button (or use Ctrl-Shft-F9), NOT just delete them one by one. If Visual Studio has mangled your solution settings the latter will not work. You may need to add a breakpoint first, in order for this to work (clever, eh?).

If worst comes to worst, you may need to delete your .suo file and let Visual Studio start a new one from scratch. Note that you will lose your personal solution configuration settings, however (only for this solution, not any others). However, you may want to move/rename the file temporarily until you determine whether or not this is the problem; that way, you can always move it back. I have seen some online resources recommend deleting (moving/renaming) the .ncb file as well.

zweiterlinde
1.Hi zweiterlinde, delete suo will impact current solution, no impact to other solutions?2.Any more detailed information about what impact will be when deleting suo file?
George2
edited answer per your question.
zweiterlinde
Hi, zweiterlinde. I find the bottleneck should deal with network. When I plug-off the network cable, the performance is very good in debugging. Do you have any ideas about why? and how to evaluate further?
George2
+1 This worked for me.
AGoodDisplayName
A: 

Go to tools/options/debugger/symbols and check if you have public symbols set or UNC network paths set. Also check tools/options/debugger/general to see if you have source server set.

All of these can affect debugging based on slow network speed or unavailable servers. The 5 minute wait time is network timeouts.

If nothing in options is set, check to see if you have the _NT_SYMBOL_PATH environment variable set.

Steve Steiner
A: 

I know this is an old topic but for what it's worth...

I've found that if I've had a seperate IE window open for a long time it can take up to a minute to start debugging. Close all IE windows and debugging starts immediately.

Robbie
A: 

I had this problem too, but it had nothing to do with breakpoints in my case. It was code shortcuts that I added in the tasks window:

http://www.customsoftwareframeworks.com/blog/longwaittimetoinsertoraddalineoftextbuginvisualstudio--tasklistwindow--onlywhenaddingandremovelines

I'm sure there are other ways you could see a problem like this, but there is a bug somewhere that caused this problem for me...deleting all my options would have fixed this, but that is something that I did not want to do. So, I debugged it and wrote about it in my blog...your problem sounds like mine.

Thanks.

shawn