File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Rubberduck.VBEEditor/Utility Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Runtime . InteropServices ;
3
4
using NLog ;
4
5
using Rubberduck . VBEditor . ComManagement ;
5
6
using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
@@ -42,7 +43,19 @@ public ICollection<QualifiedModuleName> OpenModules()
42
43
{
43
44
using ( openCodePane )
44
45
{
45
- openModules . Add ( openCodePane . QualifiedModuleName ) ;
46
+
47
+ try
48
+ {
49
+ var qmn = openCodePane . QualifiedModuleName ;
50
+ openModules . Add ( qmn ) ;
51
+ }
52
+ catch ( COMException ex )
53
+ {
54
+ //For some reason, we sometimes get a COM Exception for 'invalid callee' here. So, we swallow it to avoid rendering rewrites unusable in that case.
55
+ //See issue #5242 at https://github.com/rubberduck-vba/Rubberduck/issues/5242
56
+ //TODO: Find the root cause of the sporadic exception and deal with it.
57
+ _logger . Warn ( ex , "Encountered an exception while getting the qualified module name of all open code panes. The current code pane will be skipped." ) ;
58
+ }
46
59
}
47
60
}
48
61
}
You can’t perform that action at this time.
0 commit comments