Skip to content

Commit b397407

Browse files
committed
Moves FileName inspection to last resort
fixes #1794
1 parent 9bafa04 commit b397407

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Rubberduck.VBEEditor/QualifiedModuleName.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ public struct QualifiedModuleName
1212
{
1313
private static string GetDisplayName(VBProject project)
1414
{
15-
//Try reading the filename first
16-
try
17-
{
18-
if (!string.IsNullOrEmpty(Path.GetDirectoryName(project.BuildFileName)))
19-
{
20-
return Path.GetFileName(project.FileName);
21-
}
22-
}
23-
catch
24-
{ //The GetFileName getter probably threw
25-
}
2615

2716
if (project.Protection == vbext_ProjectProtection.vbext_pp_none)
2817
{
@@ -77,6 +66,19 @@ private static string GetDisplayName(VBProject project)
7766
//The Properties collection either wasn't available, or didn't have the expected properties
7867
}
7968
}
69+
70+
//Try reading the filename
71+
try
72+
{
73+
if (!string.IsNullOrEmpty(Path.GetDirectoryName(project.BuildFileName)))
74+
{
75+
return Path.GetFileName(project.FileName);
76+
}
77+
}
78+
catch
79+
{ //The GetFileName getter probably threw
80+
}
81+
8082
return null;
8183
}
8284

0 commit comments

Comments
 (0)