Skip to content

Commit 88cb6c2

Browse files
committed
Merge pull request #1723 from ThunderFrame/next
Careful assignment of ProjectID - Avoids project collisions
2 parents 7123cac + f4964ac commit 88cb6c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,18 @@ public void AddProject(VBProject project)
8383
return;
8484
}
8585

86+
//assign a hashcode if no helpfile is present
8687
if (string.IsNullOrEmpty(project.HelpFile))
8788
{
8889
project.HelpFile = project.GetHashCode().ToString();
8990
}
91+
92+
//loop until the helpfile is unique for this host session
93+
while (_projects.Any(a => a.Key == project.HelpFile))
94+
{
95+
project.HelpFile = (project.GetHashCode() ^ project.HelpFile.GetHashCode()).ToString();
96+
}
97+
9098
var projectId = project.HelpFile;
9199
if (!_projects.ContainsKey(projectId))
92100
{

0 commit comments

Comments
 (0)