Search

Builds occur on the UI thread in VS 2010 by Stephen Styrchak

Closed
as Fixed Help for as Fixed

95
0
Sign in
to vote
Type: Bug
ID: 645579
Opened: 2/20/2011 4:41:37 PM
Access Restriction: Public
1
Workaround(s)
50
User(s) can reproduce this bug
I very often see a dialog box pop up to tell me that VS is busy, and to report the issue to Microsoft if I see the message often. The reason I see this dialog all the time is because I build projects that take a long time to build. While they are building, VS is completely blocked, doesn't update the Output Window, and is essentially useless until the build completes.

I also see this behavior when I run commands in C# project post-build events. The IDE freezes until the commands are completed. This is a regression in behavior from VS 2008 and it is super-frustrating.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Performance

Steps to reproduce

REPRO:
1. Unzip the attached solution (UIBlockedRepro.zip)
2. Open the solution in VS 2010.
3. Open the Output Window so that it is visible.
4. Build the solution.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

There are two projects in the solution. Observations are:
1. Sleep builds and Output Window is updated with build output.
2. VS IDE becomes unresponsive for 30 seconds. During this time, no build output appears in the Output Window.
3. If you try to activate another document window near the beginning of the build, you will see the "VS is busy" popup.

Expected results

Output window updates as the build progresses, and IDE can still be used to do other stuff, like browse source code or review/edit bugs in TFS.
File Attachments
File Name Submitted By Submitted On File Size  
VSisBusy.PNG 2/20/2011 34 KB
UIBlockedRepro.zip 2/21/2011 19 KB
Sign in to post a comment.
Posted by Microsoft on 12/7/2011 at 7:24 PM
Hi folks,

We have addressed this issue in the next version of Visual Studio where builds for VB and C# projects have been moved off of the UI thread. If you would like, you can preview the change by downloading the Visual Studio Developer preview from http://msdn.microsoft.com/en-us/vstudio/hh127353 .

However, I also realize that this doesn't improve your current experience with VS2010. For VS2010 and previous releases, I'd highly recommend reading through this blog post by Scott Hanselman, where he discusses a mechanism for running builds out of the VS process, and parallelizing the builds along the way to improve your build's performance:
http://www.hanselman.com/blog/FasterBuildsWithMSBuildUsingParallelBuildsAndMulticoreCPUs.aspx


We appreciate the feedback and your patience with our reply on this request.

Thanks,
Nathan Halstead
Visual Studio Program Manager
Posted by Lasse Tassing on 10/18/2011 at 3:53 AM
@Rami_: As far as I can tell this only fixes the problem with post-builds. I'm currently on a project with buildtimes around 4-5 minutes (mostly due to the total incompetence that the build system in VS2010 was made with) and like Eric pointed out, it is extremely annoying that the entire UI is unresponsive.

I would hope Microsoft could send out a hotfix, since this is very counterproductive when working with larger projects. I'm still trying to comprehend why this was not fixed in SP1...
Posted by rami_ on 7/6/2011 at 11:52 PM
See the workarounds tab for a work-around using a custom msbuild task.
Posted by rami_ on 7/6/2011 at 2:54 PM
I am wondering if using an msbuild <exec> task (or a custom msbuild task that behaves like <exec>) for example can be used to work-around this issue??
Posted by Julien Ellie on 5/7/2011 at 1:58 PM
Fix this, it's not only a bug it's a regression...
Posted by Andy Dunn on 3/15/2011 at 7:54 PM
I have a project with both a HUGE XNA build process AND a large post build step in my release scenario. Not only does it appear to hang there is no way to break into the build if I notice something is wrong.

Its very hard to see the progress as well so you know everything is happening.


Posted by Eric Cosky on 3/6/2011 at 6:59 PM
It seems likely that the output from the project could (and should) be processed by a worker thread that monitors the output stream of the worker build via ProcessStartInfo.RedirectStandardOutput.. which it must already be doing in order to put it in the output window in the first place. There is no good reason for the Visual Studio UI to do a blocking read on the stream and remain unresponsive until the worker processes are completed. We have many time consuming external build tasks and this is an ongoing source of lost productivity for us that I hope can be corrected soon.
Thanks


Posted by Stephen Styrchak on 2/21/2011 at 7:45 AM
I'm disappointed that after I listed six scenarios in which this bug could be reproduced, this bug was closed immediately because ONE of the six scenarios was external. What about the other five? The point of the list was to illustrate how common this problem can be.

I've now attached a solution that reproduces the problem quite clearly and uses only C# console application projects. One of the projects has a post-build event to simulate a long-running build task, which was one of the repro scenarios I listed in the first place.
Posted by Microsoft on 2/21/2011 at 1:44 AM
Unfortunately, we only accept feedback on Visual Studio & .Net Framework and related technologies through this site. For issues related to XNA, we advise contacting the XNA team through the XNA Connect Site: https://connect.microsoft.com/site/sitehome.aspx?SiteID=226
Posted by Microsoft on 2/20/2011 at 5:02 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by rami_ on 7/6/2011 at 11:52 PM
I uploaded a patch to MSBuild Extension Pack that implements a custom msbuild task called SmartExec that works around this issue.

http://msbuildextensionpack.codeplex.com/workitem/9053
http://msbuildextensionpack.codeplex.com/SourceControl/list/patches
Patch Id 9878