From 94d2fe8edb5c1bc4e55a31eb0213b5e8f2f45b9a Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 10 Jan 2019 16:31:35 -0800 Subject: [PATCH] fix #1689 --- src/PowerShellEditorServices/Workspace/Workspace.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/PowerShellEditorServices/Workspace/Workspace.cs b/src/PowerShellEditorServices/Workspace/Workspace.cs index d74bf4955..6b31b094f 100644 --- a/src/PowerShellEditorServices/Workspace/Workspace.cs +++ b/src/PowerShellEditorServices/Workspace/Workspace.cs @@ -408,7 +408,6 @@ private void RecursivelyFindReferences( GetBaseFilePath( scriptFile.FilePath); - ScriptFile referencedFile; foreach (string referencedFileName in scriptFile.ReferencedFiles) { string resolvedScriptPath = @@ -429,12 +428,9 @@ private void RecursivelyFindReferences( referencedFileName, resolvedScriptPath)); - // Make sure file exists before trying to get the file - if (File.Exists(resolvedScriptPath)) + // Get the referenced file if it's not already in referencedScriptFiles + if (this.TryGetFile(resolvedScriptPath, out ScriptFile referencedFile)) { - // Get the referenced file if it's not already in referencedScriptFiles - referencedFile = this.GetFile(resolvedScriptPath); - // Normalize the resolved script path and add it to the // referenced files list if it isn't there already resolvedScriptPath = resolvedScriptPath.ToLower();