96

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.

ProfK
  • 49,207
  • 121
  • 399
  • 775
  • 4
    This is a bit left-field, so will make comment rather than answer - but if I get this is is normally because I have an RDC window open to another computer, and have recently put something in that RDC window into the clipboard (via a copy/cut) then sometimes you'll find that it is currently trying to transfer it into my local machine... and therefore my VS is waiting for that to complete. Closing the RDC normally sorts it – freefaller Aug 29 '12 at 10:26
  • 2
    Thanks @freefaller, but I never have any remote connections active. – ProfK Aug 29 '12 at 12:23
  • Thought it was unlikely, but worth a shot - good luck figuring it out – freefaller Aug 29 '12 at 13:09
  • 3
    Have the exact issue! It is really really annoying ...could you find the source of problem? (P.S. I don't have ReSharper) – Mahmoud Moravej Sep 02 '12 at 19:07
  • Addins is more likely where the problem lies. I found that uninstaling PerfWatson extension improved things a lot. I get these less often, even with ReSharper enabled. And when I do get these, they go away quickly. – Mrchief Sep 14 '12 at 16:56
  • Is MS will do something that work good on the first time?!! – hackp0int Oct 31 '12 at 10:32
  • 1
    I also have the issue in VS2010, so this is no Vs2012 issue. For me it happens when I open a Solution which has many source files open. After killing the VS with ProcExp, VS doesn't open all files and the issue is gone. – magicandre1981 Nov 26 '12 at 12:42
  • I have also observed this due to local clipboard operations, not just via RDP – James L Dec 13 '12 at 11:23
  • 7
    There are times when I'd just like to go to the nearest Microsoft office and perform a texas massacre on them for this. I'm peacefully writing a code, thoughts are going on in my head when BAM! a slap into the face "background operations, duh". – Filip Vondrášek Aug 31 '13 at 17:30

20 Answers20

63

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

Walter
  • 1,855
  • 18
  • 29
  • 27
    I upvoted and am going to comment. The update in this Answer solved the Copy/Paste problem for me with VS2012 - a problem I struggled with for over two weeks trying to figure out. Note that I selected "Web Development (Code Only)" in the last part of the Reset all Settings wizard. PLEASE UPVOTE SO THIS ANSWER SHOWS UP BETTER ON SEARCHES. – REMESQ Nov 16 '12 at 00:18
  • 2
    What Remesq said worked for me. It solved the problem instantly. Thanks. – draconis Nov 22 '12 at 11:02
  • 1
    +1 For me I couldn't paste into 'aspx' files without the 'Waiting for a background...' message appearing. Going to ***Tools > Import and Export Settings > Reset all settings*** and finally choosing ***Web Development*** when asked which collection to reset, fixed it for me. Thank you. – Anthony Walsh Mar 28 '13 at 14:42
  • Reset all settings works for a while, but every now and then I still have this annoying modal window arg!!!! – coffekid Sep 23 '13 at 02:11
  • I had the same exact problem in my vm running win8+vs2012 .. it suddenly started showing such a msg every now and then in several circumstances, in particular when I was trying to switch to a different TabPage of a specific TabControl while in design mode. I did as suggested above and finally it worked with no more warnings. I still ignore if I will ever be victim again of the same problem, anyway it's fixed now. – Diego D Nov 05 '13 at 20:34
  • 2
    +1 With Resharper 7 switching the Tools > Options > Text Editor > HTML setting to block from 'smart' corrected the issue for me – Tahbaza Dec 08 '13 at 16:20
  • Smart tabulators were causing the problem for me too. – Krisztián Balla Feb 07 '14 at 12:35
  • While selecting **Reset all Settings** may work, it feels like using a sledgehammer to fix the issue. What if I had settings I wanted to not have to reconfigure? Does anyone know the particular setting (or combination of settings) that causes this issue so those specific settings can be adjusted? – Ryan Griffith May 19 '15 at 14:47
  • You could export your current settings, reset, then export again and diff the exports. It would be nice to know what setting caused the problem. – Walter May 19 '15 at 15:49
32

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.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
7

Deleting the Solutions "suo" file worked for me.

chris.rickard
  • 1,035
  • 1
  • 11
  • 11
  • 1
    I got to this state after switching many times between branches in git. Deleting the .suo file for the project did it for me too – agarcian Jun 18 '15 at 02:10
6

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.

Ric Tokyo
  • 6,577
  • 3
  • 30
  • 48
  • This happened to me after installing a new CodeRush version then deinstalling the old one. After simply waiting (a loooong) time VS.Net simply finished whatever it was doing. – CodingBarfield Mar 11 '13 at 08:34
  • Grrrrr - this was my problem too, my toolbox was hidden so I couldn't see what was going on. – Fergal Moran Jun 07 '13 at 11:02
  • Another DevExpress user here, I find it does this after every upgrade of DevExpress. Takes about 5 minutes then is fixed for good. – KingCronus Jun 17 '13 at 13:00
5

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

The problematic version was 1.6

Roman
  • 276
  • 2
  • 5
5

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

gdbdable
  • 4,445
  • 3
  • 30
  • 46
Jits
  • 712
  • 7
  • 11
3

This fixed it for me:

Tools > Options > Text Editor > HTML > Miscellaneous

Uncheck the option "Auto ID elements on paste in Source View"

I will post an update if the problem comes back.

TheTim
  • 31
  • 3
2

I had this problem for a couple of days, tried uninstalling and reinstalling my visual studio 2012 ultimate edtion SP3... Still didn't work. So I deleted all my extensions (git tools for VS 2012 and Nuget Package downloader), restarted my VS and it worked liked a charm again! Hope it works !

Good luck!

1

http://geekswithblogs.net/sevenfortytwo/archive/2006/11/23/97947.aspx

RUN> iisreset 

Now it is working fine with VS 2012

Machavity
  • 30,841
  • 27
  • 92
  • 100
Ramu
  • 11
  • 1
1

I experienced this problem while running visual studio in a virtual machine - Virtual Box 4.2 running on Mac OS X Mountain Lion, hosting a fresh Windows 7 install with nothing else installed but Visual Studio. I found that the problem was caused by 2 separate issues.

Firstly, my project was on a folder shared from the host OS. In other words, on the Windows Guest, my project appeared on a network drive. So opening the project in Visual Studio from a network drive seemed to cause this problem because the problem went away when I copied the project onto the C drive of the Windows VM and opened it in Visual Studio from the copy on the C drive.

Secondly, I began to experience the problem again when the hard drive on the virtual machine was getting full. I had about 1GB free space available on the hard drive. When I increased the size of the hard drive on the virtual machine, this issue went away.

Machaba
  • 106
  • 1
  • 3
1

Just reproduced similar problem with Codemaid add-on. Found this conversation:

There's a lot of details in this issue, but to try and recap the issue is that the VS2012 C++ API introduced a deadlock issue when the API is accessed from a UI thread (e.g. a WPF context like Spade). It wasn't an issue in VS2010, and Microsoft has fixed it going forwards for VS2013 but they will not be patching it for VS2012.

Seems to indicate that a fix (for Codemaid) should be coming:

Please keep an eye on this thread for the ongoing resolution of the issue. It ties in to that larger rewrite so I've been building towards it by adding a lot of unit tests first to help ensure functionality remains consistent after the changes.

dtmland
  • 2,136
  • 4
  • 22
  • 45
  • 1
    It's been fixed now (version 0.7.0). This was the cause of my version of this, so thanks! – dlanod Dec 13 '13 at 06:16
1

For me it seemed to be related with the razor syntax, since I only had it on one particular file.

For example if I put the following code in one line I had the described issue.

@section BodyClassName {note}

But when putting the closing parenthesis on the next line the issue went away

@section BodyClassName {note
}

Kind regards

Stijn

1

Far from an ideal solution, but please trying running visual studio in administrator mode i tried virtually everything, and this was the only thing that worked for me

Quade
  • 75
  • 9
1

Open Visual Studio, create a new MVC application, close the new application, open the old application and it works!

abiNerd
  • 1,976
  • 1
  • 18
  • 22
  • Same issue as OP came up out of the blue. VS2013 on WebForms project. Your procedure cleared the issue. – secretwep Jun 15 '15 at 23:45
1

Check if IIS or another process (BizTalk maybe) is locking your DLLs/references
Kill/stop IIS or the other process if it is

houss
  • 670
  • 5
  • 9
0

i think i have found a clue! Every thing is ended to dcomcnfg.exe!

Open it and go under following path:

Component services>computers>my computer>dcom config

after click on dcom you'll see many warnings depend on amount of components on your pc.

Click yes on each message box in order to add correct record for dcom.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Senamas
  • 1
  • 2
  • 1
    How did you narrow it down to DCOM? What OS are you on? I don't see any warnings on my Win 7 x64 box. – Mrchief Sep 17 '12 at 14:48
0

I found that VS also loads packages during the "background operation". You can remove unneeded extensions to make the operation faster.

Libor
  • 3,285
  • 1
  • 33
  • 41
0

I have it fixed weeks ago after I turn TeamViewer 8 Clipboard Sync off! now it appears back with no reason so I tried reset all settings and it worked for me.

Afshin
  • 530
  • 5
  • 8
0

I was having the same problem and running VS as an administrator seems to have done the trick for me (I had posted a similar question at Visual Studio 2012 Express Hangs with Message "Waiting for Background Operation to Complete" on Format Document Command that was marked as a duplicate for this one so I figured I would share here as well).

Community
  • 1
  • 1
Chris Searles
  • 2,322
  • 17
  • 32
0

For me, it was Resharper addon opening a dialog which didn't show. I only found the dialog icon in the hidden icons menu on the task bar. When i got rid of the dialog, Visual Studio returned to normal immediately.

JanBrus
  • 1,198
  • 9
  • 13