Skip to content

Commit 9d78d40

Browse files
committed
handle (log) exceptions thrown loading from type libraries
1 parent c4da1dd commit 9d78d40

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Rubberduck.Parsing/VBA/RubberduckParser.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,20 @@ private void SyncComReferences(IReadOnlyList<IVBProject> projects)
430430
loadTasks.Add(
431431
Task.Run(() =>
432432
{
433-
var comReflector = new ReferencedDeclarationsCollector(State);
434-
var items = comReflector.GetDeclarationsForReference(localReference);
433+
try
434+
{
435+
var comReflector = new ReferencedDeclarationsCollector(State);
436+
var items = comReflector.GetDeclarationsForReference(localReference);
435437

436-
foreach (var declaration in items)
438+
foreach (var declaration in items)
439+
{
440+
State.AddDeclaration(declaration);
441+
}
442+
}
443+
catch (Exception exception)
437444
{
438-
State.AddDeclaration(declaration);
445+
Logger.Warn(string.Format("Types were not loaded from referenced type library '{0}'.", reference.Name));
446+
Logger.Error(exception);
439447
}
440448
}));
441449
map.IsLoaded = true;

0 commit comments

Comments
 (0)