Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this 'Waiting for Background operation' in Visual Studio 2012?

Occassionaly, but fairly often, for no apparent reason, VS 2012 will lock up with a dialogue that says, "Waiting for a background operation to finish". E.g. this may happen during a plain old code edit, not on explicitly invoking any IDE command.

What causes this, and is there anything I can do about this?

I am running ReSharper 7, and I am not the only one I know experiencing this.

like image 588
ProfK Avatar asked Aug 29 '12 10:08

ProfK


6 Answers

I was having the same problem, especially in cshtml pages. I found this page: https://devblogs.microsoft.com/aspnet/visual-studio-11-beta-razor-editor-issue-workaround that suggests changing the indent option in Tools > Options > Text Editor > HTML > Tab to Smart instead of Block. In my case it was already set to Smart and changing it back to Block fixed the problem.

Update: I was wrong, that didn't fix the dialogue, it just delayed it until I copied or pasted. What finally worked for me was to go to Tools > Import and Export Settings... > Reset all settings.

Possibly related question: Visual Studios 2010 - Asp.net MVC 4 Beta - long delays on paste and frequent crashing

like image 129
Walter Avatar answered Nov 09 '22 09:11

Walter


It is a very generic diagnostic. It is triggered by COM, heavily used in Visual Studio to implement extensibility. The underlying trigger is the IMessageFilter interface. The trigger occurs when COM marshals a method call to another thread and that call doesn't complete for 60 seconds.

There's little value in the actual notification, it is telling you something you already know. By the time 60 seconds have passed, you typically already have noticed things are not working well. Short from the wee bit of useful knowledge that Visual Studio isn't actually completely dead. The call however has to complete before VS gets usable again. There's little you can do but tap your foot and wait.

This problem is almost always caused by an add-in. Resharper is certainly a good candidate. You find the trouble-maker by disabling the add-ins one-by-one until the problem disappears. It is the kind of problem that's common with new versions of Visual Studio, it takes the add-in vendors a while to get the bugs and hangups ironed out. Contact the vendor for support and in general look for updates that may solve the issue.

like image 32
Hans Passant Avatar answered Nov 09 '22 09:11

Hans Passant


Deleting the Solutions "suo" file worked for me.

like image 7
chris.rickard Avatar answered Nov 09 '22 10:11

chris.rickard


I was having the same problem and in my case it was DevExpress.

It seemed to hang Visual Studio everytime I did a copy or cut operation, bringing up the message:

"Waiting for a background operation to finish".

Turns out it was actually doing a one off task in the background and it really was taking a while to do it (over 5 minutes).

Perhaps if I had waited normally, it could have gone away, but what finally fixed it was to bring up the Toolbox into view (was hidden/collapsed), which in turn brought up a window saying:

"adding [SomeDevExpressAssemblyNameHere].dll"

this kept updating itself with the name of every dll required by DevExpress to populate the toolbar.

This way I could see the operation progress and after it finished I could use copy/cut paste again as usual.

Hope this helps.

like image 6
Ric Tokyo Avatar answered Nov 09 '22 10:11

Ric Tokyo


For me the fix was to update the Web Essentials 2012 to version 1.8.

The problematic version was 1.6

like image 5
Roman Avatar answered Nov 09 '22 11:11

Roman


Tools > Options > Text Editor > HTML > Tabs -> Identing -> None settings solved this problem for me.

like image 5
Jits Avatar answered Nov 09 '22 10:11

Jits