8

I am doing PHP development in Visual Studio, and my solution contains projects for PHP, SSRS, and SQL Server (SSDT). And I am using TFS for version control. So there's a lot going on in my dev environment that can "go wrong".

I am experiencing intermittent hangs, usually around 5 minutes a clip. Visual Studio gives me the wait cursor, and if I click anywhere in VS the window dims. And then I just have to wait it out. Sometimes I can end the devenv.exe task, other times it takes several minutes to terminate the task. If I am feeling patient, I just wait and eventually (around 5 mins) VS comes back to life. I've never experienced loss of data, source control issues, etc, even when I terminate the process.

It happens sometimes when I save. Sometimes when I check-in. Sometimes when I check out. Sometimes when I build. I have been unable to discern any sort of pattern of the behavior.

All my workstation resources are fine- no RAM or i/o or network or CPU issues.

What can I do to troubleshoot this issue? Can I run VS in some sort of logging mode that would allow me to pinpoint what is taking so long during these periods of lockup?

3
  • Run it in safe mode to see if it's an add-in: devenv.exe /SafeMode Sep 6, 2013 at 13:47
  • You can also try turning on logging: denenv.exe /log
    – Mike Cheel
    Sep 6, 2013 at 14:00
  • @ta.speeot.is - If I run in safe mode, I can't load my project since it is dependent on extensions to do my PHP development.
    – Shoeless
    Sep 8, 2013 at 12:42

3 Answers 3

10

To turn on logging in visual studio, run: devenv.exe /log

I personally would do this with a shortcut.

4
  • 3
    For others reading this, you must also specify a log file name in the command line, for example: devenv.exe /log c:\temp\vs.log (see also msdn.microsoft.com/en-us/library/ms241272(v=vs.110).aspx)
    – Shoeless
    Sep 8, 2013 at 12:19
  • 1
    Here's a helpful link... It targets VS2010, and the images are broken, but it's the best article I could find on the subject: blogs.msdn.com/b/visualstudio/archive/2010/02/24/…
    – Shoeless
    Sep 8, 2013 at 12:43
  • VS hung. I looked at the log and saw that my Layouts-o-rama extension had a bunch of errors. I disabled that extension, and haven't had VS lock up since!
    – Shoeless
    Sep 10, 2013 at 13:27
  • 2
    If you don't specify a log file name then the default log file is at: %APPDATA%\Roaming\Microsoft\VisualStudio\<version>\ActivityLog.xml I'm glad the logging helped you.
    – Mike Cheel
    Sep 10, 2013 at 14:24
5

Consider deleting old TFS Workspace definitions left over from Continuous Integration Builds.

We had this same problem with a large Team Foundation Server project tree. Sometimes, but not always, opening a Solution in Visual Studio 2010 or Visual Studio 2012 would hang exactly as described above. VS 2010 was most vulnerable; VS 2012 seemed less vulnerable, but it still would hang.

We were able to get some clues by monitoring the server activity on the TFS Server machine and the underlying SQL Server machine. A certain query stored procedure was using excessive CPU time in SQL Server. We tracked this stored procedure name to a TFS operation involved in scanning TFS Workspace definitions for other user's checkouts for files.

Our TFS environment has been in use for over 3 years, and we have been using Continuous Integration build definitions using a "zombie army" of developer workstations as TFS Build Agent hosts. We also create new TFS Branches for major releases. Each branch contains about 20 separate Visual Studio Solutions with their own build definitions.

Over time, we had accumulated about 2,000 TFS Workspace definitions on each developer workstation. We had about 10 workstations at one time with their own definitions.

Using the Visual Studio Command window and running as a TFS Administrator, we used this command to identify all workspaces created by our "build user":

tf workspaces /collection:tfservername\collectionname /owner:ourbuilduser >c:\tf_ws_del.bat

We then used global substitutes and the Notepad++ editor macro recorder to convert each result line into this form:

tf workspace /delete /collection:tfservername\collectionname workspacename;ourbuilduser <c:\yes.txt

where C:\yes.txt contained a single line of "y"

We also used some human judgement to remove deletion lines for workspaces named for our most recent TFS branch.

We then ran that c:\tfs_ws_del.bat script in the same Visual Studio Command window and waited patiently for it to finish.

End Result: Our Visual Studio solutions open very quickly. Even browsing the folder hierarchy in Source Control Explorer has sped up considerably.

WARNING: The deletion operations for a very large number of workspaces may expand the TempDB on the underlying SQL Server by a large amount. Coordinate with your DBA's to monitor space on the SQL Server machine. Stopping and restarting the TFS Collection via the graphical TFS Administrator Console tool helps reclaim some of that TempDB space and return it to its internal "free block" list.

0

This can also seem to happen when the symbol servers specified in your debug options are down or unreachable... it will not actually hang in this case but seem to as it times out for each file access.

To temporarily get around this problem uncheck the symbol servers that are down.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.