Skip to content

Commit 22366a6

Browse files
committed
2 parents f1c689f + 691e6f2 commit 22366a6

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Rubberduck.Parsing/VBA/RubberduckParser.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ private string GetReferenceProjectId(IReference reference, IReadOnlyList<IVBProj
382382
private void SyncComReferences(IReadOnlyList<IVBProject> projects)
383383
{
384384
var loadTasks = new List<Task>();
385+
var unmapped = new List<IReference>();
385386

386387
foreach (var vbProject in projects)
387388
{
@@ -397,8 +398,8 @@ private void SyncComReferences(IReadOnlyList<IVBProject> projects)
397398
// skip loading Rubberduck.tlb (GUID is defined in AssemblyInfo.cs)
398399
if (reference.Guid == "{E07C841C-14B4-4890-83E9-8C80B06DD59D}")
399400
{
400-
// todo: figure out why Rubberduck.tlb can't be loaded that way
401-
continue;
401+
// todo: figure out why Rubberduck.tlb *sometimes* throws
402+
//continue;
402403
}
403404
var referencedProjectId = GetReferenceProjectId(reference, projects);
404405

@@ -442,6 +443,7 @@ private void SyncComReferences(IReadOnlyList<IVBProject> projects)
442443
}
443444
catch (Exception exception)
444445
{
446+
unmapped.Add(reference);
445447
Logger.Warn(string.Format("Types were not loaded from referenced type library '{0}'.", reference.Name));
446448
Logger.Error(exception);
447449
}
@@ -458,7 +460,6 @@ private void SyncComReferences(IReadOnlyList<IVBProject> projects)
458460
mappedIds.Add(item.ReferencedProjectId);
459461
}
460462

461-
var unmapped = new List<IReference>();
462463
foreach (var project in projects)
463464
{
464465
var references = project.References;

Rubberduck.VBEEditor/Events/Sinks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void Stop()
5656

5757
private void RegisterComponentsEventSink(IVBComponents components, string projectId)
5858
{
59-
if (_componentsEventsSinks.ContainsKey(projectId))
59+
if (projectId == null || _componentsEventsSinks.ContainsKey(projectId))
6060
{
6161
// already registered - this is caused by the initial load+rename of a project in the VBE
6262
return;
@@ -77,7 +77,7 @@ private void RegisterComponentsEventSink(IVBComponents components, string projec
7777

7878
private void UnregisterComponentsEventSink(string projectId)
7979
{
80-
if (!_componentsEventsSinks.ContainsKey(projectId)) { return; }
80+
if (projectId == null || !_componentsEventsSinks.ContainsKey(projectId)) { return; }
8181

8282
var componentEventSink = _componentsEventsSinks[projectId];
8383
var info = _componentEventsInfo[projectId];

Rubberduck.VBEEditor/SafeComWrappers/VBA/CodePane.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private Selection GetSelection()
8888
return new QualifiedSelection(moduleName, selection);
8989
}
9090

91-
public void SetSelection(int startLine, int startColumn, int endLine, int endColumn)
91+
private void SetSelection(int startLine, int startColumn, int endLine, int endColumn)
9292
{
9393
Target.SetSelection(startLine, startColumn, endLine, endColumn);
9494
ForceFocus();
@@ -110,6 +110,10 @@ private void ForceFocus()
110110
{
111111
NativeMethods.ActivateWindow(handle, mainWindowHandle);
112112
}
113+
else
114+
{
115+
System.Diagnostics.Debug.WriteLine("CodePane.ForceFocus() failed to get a handle on the MainWindow.");
116+
}
113117
}
114118

115119
public void Show()

0 commit comments

Comments
 (0)