Skip to content

Commit 6b306ba

Browse files
authored
Merge pull request #4665 from comintern/next
Fixes broken VBIDE API Reference.IsBroken property getter... Oh, the irony!
2 parents dda9300 + 3ddbec3 commit 6b306ba

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

Rubberduck.VBEditor.VB6/SafeComWrappers/VB/Reference.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.InteropServices;
12
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
23
using VB = Microsoft.Vbe.Interop.VB6;
34

@@ -49,9 +50,8 @@ public string FullPath
4950
{
5051
return IsBroken ? string.Empty : Target.FullPath;
5152
}
52-
catch (System.Runtime.InteropServices.COMException)
53+
catch (COMException)
5354
{
54-
5555
return string.Empty;
5656
}
5757
}
@@ -64,7 +64,19 @@ public bool IsBuiltIn
6464

6565
public bool IsBroken
6666
{
67-
get { return IsWrappingNullReference || Target.IsBroken; }
67+
get
68+
{
69+
try
70+
{
71+
return IsWrappingNullReference || Target.IsBroken;
72+
}
73+
catch (COMException ex)
74+
{
75+
_logger.Trace(ex, "IsBroken is broken.");
76+
}
77+
78+
return true;
79+
}
6880
}
6981

7082
public ReferenceKind Type

Rubberduck.VBEditor.VBA/SafeComWrappers/VB/Reference.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.InteropServices;
12
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
23
using VB = Microsoft.Vbe.Interop;
34

@@ -49,9 +50,8 @@ public string FullPath
4950
{
5051
return IsBroken ? string.Empty : Target.FullPath;
5152
}
52-
catch (System.Runtime.InteropServices.COMException)
53+
catch (COMException)
5354
{
54-
5555
return string.Empty;
5656
}
5757
}
@@ -64,7 +64,19 @@ public bool IsBuiltIn
6464

6565
public bool IsBroken
6666
{
67-
get { return IsWrappingNullReference || Target.IsBroken; }
67+
get
68+
{
69+
try
70+
{
71+
return IsWrappingNullReference || Target.IsBroken;
72+
}
73+
catch (COMException ex)
74+
{
75+
_logger.Trace(ex, "IsBroken is broken.");
76+
}
77+
78+
return true;
79+
}
6880
}
6981

7082
public ReferenceKind Type

0 commit comments

Comments
 (0)