rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 301 forks source link

RPC_E_SERVERCALL_RETRYLATER exception pressing Refresh too many times #1602

Closed ThunderFrame closed 8 years ago

ThunderFrame commented 8 years ago

I'm trying to get Rubberduck to parse an empty project in MSProject 2003 (yes, it's old, but it's all I have, so if you get no repro, close this issue), although MSProject loads ProjectGlobal (Global.mpt) too, so there are components to parse.

On open, RD toolbar freezes on Parsing. Hitting refresh causes it o freeze on Pending. Hitting refresh again, and again, finally got me to Parse Error, but when inspecting the errors, there were none.

Hitting refresh again resulted in Inspecting and then crash, but on another try it reached Ready, but when I tried viewing Inspections it was empty.

Frustrated, I hit refresh several times, until I got this exception:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x8001010A): The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
   at Microsoft.Vbe.Interop._VBComponent.get_Type()
   at Rubberduck.Common.DeclarationExtensions.<FindFormEventHandlers>b__32(Declaration item) in c:\Users\Andrew\Documents\GitHub\Rubberduck\RetailCoder.VBE\Common\DeclarationExtensions.cs:line 278
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Rubberduck.Common.DeclarationExtensions.FindFormEventHandlers(IEnumerable`1 declarations) in c:\Users\Andrew\Documents\GitHub\Rubberduck\RetailCoder.VBE\Common\DeclarationExtensions.cs:line 278
   at Rubberduck.Inspections.ParameterCanBeByValInspection.GetInspectionResults() in c:\Users\Andrew\Documents\GitHub\Rubberduck\RetailCoder.VBE\Inspections\ParameterCanBeByValInspection.cs:line 51
   at Rubberduck.Inspections.Rubberduck.Inspections.Inspector.<>c__DisplayClass6.<>c__DisplayClass8.<FindIssuesAsync>b__3() in c:\Users\Andrew\Documents\GitHub\Rubberduck\RetailCoder.VBE\Inspections\Inspector.cs:line 78
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
ThunderFrame commented 8 years ago

The error seems to occur in the Inspecting state, as that is what I see briefly before the exception.

I just got repro of the Parser Error state and empty Error dialog:

proj

The next refresh after that zombie Parser Error results in an almost instant Ready state, but the Inspections window is empty, and subsequent refreshes leave the state at Ready until I add a module and hit refresh again.

comintern commented 8 years ago

I believe this is a threading issue with COM. This link might be relevant.

retailcoder commented 8 years ago

Closing as a dupe of #1617; outright disabling the refresh commands when refreshing isn't possible should fix this issue.