Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix references crash #826

Merged
merged 2 commits into from
Dec 18, 2018
Merged

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Dec 15, 2018

Fixes PowerShell/vscode-powershell#1652 by making the OrderedDictionaries more resilient

@@ -330,22 +330,28 @@ public FindOccurrencesResult FindSymbolsInFile(ScriptFile scriptFile)
? new OrderedDictionary()
: new OrderedDictionary(StringComparer.OrdinalIgnoreCase);

foreach (ScriptFile file in referencedFiles)
foreach (ScriptFile scriptFile in referencedFiles)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{
fileMap.Add(file.FilePath, file);
if (!fileMap.Contains(scriptFile.FilePath))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use the indexer:

fileMap[scriptFile.FilePath] = scriptFile;

That creates the entry if it doesn't exist and writes a new value if it does exist.

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rjmholt rjmholt merged commit 729711a into PowerShell:master Dec 18, 2018
@TylerLeonhardt TylerLeonhardt deleted the fix-references-crash branch September 16, 2019 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants