Open Irubataru opened 5 years ago
I am at a loss what might be the root cause here. It is expected that every CodePane
belongs to a CodeModule
and that it can be obtained via the CodeModule
property of the code pane object from the interop library.
I guess, we could wrap the request for the QualifiedModuleName
in SelectionService.OpenModules
in a try-catch block and log COM exceptions as warnings. That will omit the corresponding components from the returned collection and thus prevent selection recovery for them, which is not ideal. However, it is better than aborting completely and rendering refactorings unusable for the rest of the session.
Version 2.4.1.5196
OS: Microsoft Windows NT 10.0.17134.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.4873.1000
Host Executable: MSACCESS.EXE
Just ran across this on a Quick Fix - Select the quick fix, nothing happens. Appears to my untrained eye to be the same type of issue.
Here's the relevant log bits from 2 successive attempts on different occurrences of the same error (Replace function {x} with existing typed function
):
2019-11-19 13:52:06.1741;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49367;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49343;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorExtractMethodCommand was registered with id 49292;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49391;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49276;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49394;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49265;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentModuleCommand was registered with id 49348;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentProcedureCommand was registered with id 49403;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49315;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49347;
2019-11-19 13:52:06.1895;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49362;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49362;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49347;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorExtractMethodCommand was registered with id 49315;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49403;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49348;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49265;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49394;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentModuleCommand was registered with id 49276;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentProcedureCommand was registered with id 49391;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49292;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49343;
2019-11-19 13:52:09.5020;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49367;
2019-11-19 13:52:10.7989;ERROR-2.4.1.5196;Rubberduck.UI.Inspections.InspectionResultsViewModel;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.Inspections.QuickFixes.QuickFixProvider.Fix(IQuickFix fix, IInspectionResult result) in C:\projects\rubberduck\Rubberduck.CodeAnalysis\QuickFixes\QuickFixProvider.cs:line 95
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.Inspections.QuickFixes.QuickFixProvider.Fix(IQuickFix fix, IInspectionResult result) in C:\projects\rubberduck\Rubberduck.CodeAnalysis\QuickFixes\QuickFixProvider.cs:line 95
at Rubberduck.UI.Command.CommandBase.Execute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\CommandBase.cs:line 85
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49265;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49367;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorExtractMethodCommand was registered with id 49343;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49292;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49391;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49276;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49394;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentModuleCommand was registered with id 49387;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentProcedureCommand was registered with id 49393;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49368;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49354;
2019-11-19 13:53:30.4874;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49381;
2019-11-19 13:53:33.5658;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49381;
2019-11-19 13:53:33.5658;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49354;
2019-11-19 13:53:33.5658;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorExtractMethodCommand was registered with id 49368;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49348;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49393;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49396;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49347;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentModuleCommand was registered with id 49362;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentProcedureCommand was registered with id 49403;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49387;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49394;
2019-11-19 13:53:33.5812;TRACE-2.4.1.5196;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49276;
2019-11-19 13:53:35.2844;ERROR-2.4.1.5196;Rubberduck.UI.Inspections.InspectionResultsViewModel;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.Inspections.QuickFixes.QuickFixProvider.Fix(IQuickFix fix, IInspectionResult result) in C:\projects\rubberduck\Rubberduck.CodeAnalysis\QuickFixes\QuickFixProvider.cs:line 95
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.Inspections.QuickFixes.QuickFixProvider.Fix(IQuickFix fix, IInspectionResult result) in C:\projects\rubberduck\Rubberduck.CodeAnalysis\QuickFixes\QuickFixProvider.cs:line 95
at Rubberduck.UI.Command.CommandBase.Execute(Object parameter) in C:\projects\rubberduck\Rubberduck.Core\UI\Command\CommandBase.cs:line 85
Closing and reopening Access seems to have cured the problem. Of course, I forgot to save off the complete log in case there was anything meaningful prior to what I posted.
I will introduce a symptomatic fix for this later today, but I am at a loss on how to fix the underlying issue.
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):
Additional context My code base is pretty big, still not sure if that is a general source of problems.