question

GiuseppeCarafa-3011 avatar image
2 Votes"
GiuseppeCarafa-3011 asked PinoCarafa-9556 commented

Visual Studio 2019 Build hangs when Error List is open

Since the last couple of updates to Visual Studio 2019 I find that my solution "hangs" very often when I rebuild it.

After some investigation it seems to me that this issue arises when the "Error List" pane is shown

80630-errorlistopen.png



When I close the Error List pane the build doesn't "hang" and it runs to completion.

I have tried various other things. For example building only the main application or building the entire solution, debug or release configurations, x86, x64 or AnyCPU platforms, none of it makes a difference.

Any idea what may be going on here?


vs-generalvs-msbuild
errorlistopen.png (102.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AnnaXiu-MSFT avatar image
0 Votes"
AnnaXiu-MSFT answered PinoCarafa-9556 commented

Hi @GiuseppeCarafa-3011 ,

Welcome to Microsoft Q&A!

What is your project type? Have you tried to create a new project and check if the situation occurs in specific project?

In addition, I suggest you close all instances of Visual Studio and update your Visual Studio 2019 to the latest version.
Then, delete the hidden .vs, bin and obj folders in the solution(project) folder.
After that, re-launch your Visual Studio and check if the situation disappears.

Sincerely,
Anna


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Anna,

It's a major solution containing 42 projects. The projects are a mixture, mainly VB.NET with a few C# projects, too, that are built as DLLs to be used by the main (VB.NET) project. I already tried deleting the .vs folder from the folder that contains the Solution (.sln) file, and that didn't help. I haven't tried deleting bin and obj folders as there is one of each in each project folder but I'll give it a try...

0 Votes 0 ·

Alas ... I tried your suggestion to delete the .vs and every bin and obj folder I could find. No joy. I am now going to remove all the projects and add them back in one by one in the correct order. sigh

0 Votes 0 ·

Hello Anna,

1/2

Well......

In the end I resorted to drastic measures.

I checked all the references in all the projects. From that I constructed a "tree" of projects with the ones that didn't reference any of the other projects listed at the top, and then down through all the projects as they started referencing more and more of the other projects. The "Project Build Order" in the Solution normally takes care of this and it builds the projects in an appropriate order but I just wasn't trusting it anymore.

I then removed all projects from the solution and started adding them back in, one at a time, in the order that I, myself, had established from the aforementioned "tree".

Between every addition I would build. And the build would work fine.

Until I added the 42nd project when it hung again.

Now I started looking at the AssemblyBindings in the Main project (number 42). I removed all bindingredirects that had crept in over the years........

0 Votes 0 ·

2/2 Obviously that caused the compiler to then throw warnings adding me to consider reapplying some of those binding redirects. But it didn't hang!

I then started re-introducing them one at a time, and at some point it started hanging again. I then discovered that the code was using a Serializer from System.Web.Script.Serialization - when a lot of the other Projects were using NewtonSoft for this. I reverted to using NewtonSoft here, too, and started removing references that I thought the project wasn't actually using. Once or twice I got it wrong and the project didn't build, and I had to re-introduce the project reference. But finally I was able to get rid of some unused references.

And now it builds without hanging.

I would love to know what is happening here. When I closed the Error List pane the entire solution would build with 0 Warnings and 0 Errors. But obviously something in the references was still not quite right and I somehow managed to fix it. But how?

0 Votes 0 ·

Whatever the case may be, you must have said something that pointed me in the right direction so I'll Accept your answer.

0 Votes 0 ·

I spoke too soon. I just tried to rebuild the solution and .... it's hanging again.

insert Sad Pablo Meme here

0 Votes 0 ·

Hello @AnnaXiu-MSFT

So far I have not had much joy with your suggestions and those provided by Karen, below.

I do think, though, that I have an inkling of who the culprit may be. Looking at my Event Viewer I find a few AppHang errors and the likes for devenv - which is indeed what I would expect considering the behaviour I'm observing, but preceding them I found the Roslyn error I mention in a reply to Karen, below.

Any idea what is going on there? Or where I can escalate this to?

0 Votes 0 ·

Ok I may be on to something.... I replaced the default .ruleset with one with pretty much everything turned off.

So far, no hangs.

Hm.

0 Votes 0 ·
karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered PinoCarafa-9556 commented

Some ideas

  • If possible, consider placing some of the project in a different Visual Studio solution and reference them in the current Visual Studio solution. The projects in the other solution would be ones that don't change or seldom change

  • Try each of the following one at a time

  • Exclude projects from a build (other possible options on this page).

  • Under Tools -> Options -> Projects and Solutions -> Build and Run. up the number of maximum of parellel project builds

  • Under Tools -> Options -> Projects and Solutions -> General, un-check "Always show Error List if build finishes with errors"

  • Also if possible, start Visual Studio in safe mode to ensure no extensions are interfering with the build

  • Try changing setting in the two combo boxes shown below

81309-errorlist.png



errorlist.png (5.5 KiB)
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you Karen, I will give those ideas a try. With regard to your first point, would it be possible to, instead of creating further Visual Studio solutions, to add Solution Configurations that exclude the projects that don't need to be rebuilt all the time?

0 Votes 0 ·

Note to self: read the entire suggestion and you'd have seen that that's exactly what Karen was suggesting in her 3rd bullet point....

My bad

0 Votes 0 ·

Ok ... progress so far:

I tried your fourth option and upped the number to 50. It worked fine once or twice but then it still hung.

I then tried your sixth suggestion. This wasn't going to work because I develop two Add-ins with Add-in Express and it gives the option to register and unregister the addins while you're doing your developer test, and for that it needs to Run As Administrator and when I started DevEnv with -SafeMode it wouldn't do that. BUT.... I then started it as normal, and looked at the Installed Extensions. I disabled Web Live Preview, Live Share, Visual Studio IntelliCode, Wax, NuGetRecommender, Visual Studio Rich Navigation, Wix Toolset Visual Studio 2019 Extension, ML.NET Model Builder (Preview) and Microsoft Library Manager. The only one I kept enabled is Microsoft Visual Studio Installer Projects (I am thinking of moving to Wix but that's been put on hold).

It's building ok. If it stays like that I may try re-enabling one at a time to see.

0 Votes 0 ·

Hello Karen,

Ok.... it still happens occasionally. Before I try one of the other suggestions though... I had a look at the Event Viewer, and I found this:

81933-roslyn.txt



Preceding various other messages

0 Votes 0 ·
roslyn.txt (6.6 KiB)

Ok I may be on to something.... I replaced the default .ruleset with one with pretty much everything turned off.

So far, no hangs.

Hm.

0 Votes 0 ·