Skip to content

Refactoring sometimes quietly exits without doing anything (Invalid callee) #5242

Open
@Irubataru

Description

@Irubataru

Rubberduck version information

Version 2.4.1.4901
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.12026.20334
Host Executable: EXCEL.EXE

Description
Sometimes when I am working Rubberduck stops doing refactorings. If I try to rename a class it simply doesn't do anything. The same thing also happens with opportunities such as adding attributes etc. Simply restarting Rubberduck fixes the problem until it appears again, doing a reparse doesn't help. I haven't been able to create a simple reproducible example, but I have had this issue for a while.

Logfile
Here is the log section from me clicking renaming a method when it fails (including end of reparse):

2019-10-24 10:56:36.0238;INFO-2.4.1.4901;Rubberduck.Parsing.Common.ParsingStageTimer;Resolved references in 9027ms.;
2019-10-24 10:56:36.0524;INFO-2.4.1.4901;Rubberduck.Parsing.Common.ParsingStageTimer;Determined module to module references in 28ms.;
2019-10-24 10:56:36.2964;INFO-2.4.1.4901;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (600) is invoking StateChanged (Ready);
2019-10-24 10:56:37.0983;INFO-2.4.1.4901;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run finished after 18,4153738s. (thread 160).;
2019-10-24 10:56:42.0678;DEBUG-2.4.1.4901;Rubberduck.UI.Command.MenuItems.ParentMenus.ParentMenuItemBase;(33375340) Executing click handler for menu item '&Rename', hash code 26118182;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49508;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49337;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49344;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49635;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49604;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49579;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49527;
2019-10-24 10:56:47.7818;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49481;
2019-10-24 10:56:47.7888;TRACE-2.4.1.4901;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49563;
2019-10-24 10:56:47.8214;ERROR-2.4.1.4901;Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand;System.Runtime.InteropServices.COMException (0x80020010): Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))
   at Microsoft.Vbe.Interop._CodePane.get_CodeModule()
   at Rubberduck.VBEditor.SafeComWrappers.VBA.CodePane.get_CodeModule() in C:\projects\rubberduck\Rubberduck.VBEditor.VBA\SafeComWrappers\VB\CodePane.cs:line 28
   at Rubberduck.VBEditor.SafeComWrappers.VBA.CodePane.get_QualifiedModuleName() in C:\projects\rubberduck\Rubberduck.VBEditor.VBA\SafeComWrappers\VB\CodePane.cs:line 77
   at Rubberduck.VBEditor.Utility.SelectionService.OpenModules() in C:\projects\rubberduck\Rubberduck.VBEEditor\Utility\SelectionService.cs:line 45
   at Rubberduck.Parsing.Rewriter.SelectionRecoverer.SaveSelections(IEnumerable`1 modules) in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\SelectionRecoverer.cs:line 31
   at Rubberduck.Parsing.Rewriter.RewriteSessionBase.PrimeSelectionRecovery() in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\RewriteSessionBase.cs:line 108
   at Rubberduck.Parsing.Rewriter.RewriteSessionBase.TryRewrite() in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\RewriteSessionBase.cs:line 99
   at Rubberduck.Refactorings.Rename.RenameRefactoring.RefactorImpl(RenameModel model) in C:\projects\rubberduck\Rubberduck.Refactorings\Rename\RenameRefactoring.cs:line 71
   at Rubberduck.Refactorings.InteractiveRefactoringBase`2.Refactor(TModel initialModel) in C:\projects\rubberduck\Rubberduck.Refactorings\InteractiveRefactoringBase.cs:line 48
   at Rubberduck.Refactorings.RefactoringBase.Refactor(QualifiedSelection targetSelection) in C:\projects\rubberduck\Rubberduck.Refactorings\RefactoringBase.cs:line 41
   at Rubberduck.UI.Command.Refactorings.RefactorCodePaneCommandBase.OnExecute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\Refactorings\RefactorCodePaneCommandBase.cs:line 30
   at Rubberduck.UI.Command.CommandBase.Execute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\CommandBase.cs:line 85;System.Runtime.InteropServices.COMException (0x80020010): Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))
   at Microsoft.Vbe.Interop._CodePane.get_CodeModule()
   at Rubberduck.VBEditor.SafeComWrappers.VBA.CodePane.get_CodeModule() in C:\projects\rubberduck\Rubberduck.VBEditor.VBA\SafeComWrappers\VB\CodePane.cs:line 28
   at Rubberduck.VBEditor.SafeComWrappers.VBA.CodePane.get_QualifiedModuleName() in C:\projects\rubberduck\Rubberduck.VBEditor.VBA\SafeComWrappers\VB\CodePane.cs:line 77
   at Rubberduck.VBEditor.Utility.SelectionService.OpenModules() in C:\projects\rubberduck\Rubberduck.VBEEditor\Utility\SelectionService.cs:line 45
   at Rubberduck.Parsing.Rewriter.SelectionRecoverer.SaveSelections(IEnumerable`1 modules) in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\SelectionRecoverer.cs:line 31
   at Rubberduck.Parsing.Rewriter.RewriteSessionBase.PrimeSelectionRecovery() in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\RewriteSessionBase.cs:line 108
   at Rubberduck.Parsing.Rewriter.RewriteSessionBase.TryRewrite() in C:\projects\rubberduck\Rubberduck.Parsing\Rewriter\RewriteSessionBase.cs:line 99
   at Rubberduck.Refactorings.Rename.RenameRefactoring.RefactorImpl(RenameModel model) in C:\projects\rubberduck\Rubberduck.Refactorings\Rename\RenameRefactoring.cs:line 71
   at Rubberduck.Refactorings.InteractiveRefactoringBase`2.Refactor(TModel initialModel) in C:\projects\rubberduck\Rubberduck.Refactorings\InteractiveRefactoringBase.cs:line 48
   at Rubberduck.Refactorings.RefactoringBase.Refactor(QualifiedSelection targetSelection) in C:\projects\rubberduck\Rubberduck.Refactorings\RefactoringBase.cs:line 41
   at Rubberduck.UI.Command.Refactorings.RefactorCodePaneCommandBase.OnExecute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\Refactorings\RefactorCodePaneCommandBase.cs:line 30
   at Rubberduck.UI.Command.CommandBase.Execute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\CommandBase.cs:line 85

Additional context
My code base is pretty big, still not sure if that is a general source of problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions