diff --git a/scripts/FetchLatestBuild.ps1 b/scripts/FetchLatestBuild.ps1 index 38b8bdbc1..00abb1c42 100644 --- a/scripts/FetchLatestBuild.ps1 +++ b/scripts/FetchLatestBuild.ps1 @@ -38,18 +38,13 @@ function Install-BuildPackage($packageName, $extension) { mkdir $binariesToSignPath -Force | Out-Null cp "$packageContentPath\lib\net45\$packageName.$extension" -Force -Destination $binariesToSignPath - # Don't forget the x86 exe - if ($extension -eq "exe") { - cp "$packageContentPath\lib\net45\$packageName.x86.$extension" -Force -Destination $binariesToSignPath - } - Write-Output "Extracted package $packageName ($buildVersion)" } # Pull the build packages from AppVeyor Install-BuildPackage "Microsoft.PowerShell.EditorServices" "dll" Install-BuildPackage "Microsoft.PowerShell.EditorServices.Protocol" "dll" -Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host" "exe" +Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host" "dll" # Open the BinariesToSign folder & start $binariesToSignPath diff --git a/src/PowerShellEditorServices/Language/LanguageService.cs b/src/PowerShellEditorServices/Language/LanguageService.cs index 2f36145cf..e7e0a3769 100644 --- a/src/PowerShellEditorServices/Language/LanguageService.cs +++ b/src/PowerShellEditorServices/Language/LanguageService.cs @@ -102,23 +102,33 @@ await this.powerShellContext.GetRunspaceHandle( if (commandCompletion != null) { - CompletionResults completionResults = - CompletionResults.Create( - scriptFile, - commandCompletion); - - // save state of most recent completion - mostRecentCompletions = completionResults; - mostRecentRequestFile = scriptFile.Id; - mostRecentRequestLine = lineNumber; - mostRecentRequestOffest = columnNumber; - - return completionResults; - } - else - { - return new CompletionResults(); + try + { + CompletionResults completionResults = + CompletionResults.Create( + scriptFile, + commandCompletion); + + // save state of most recent completion + mostRecentCompletions = completionResults; + mostRecentRequestFile = scriptFile.Id; + mostRecentRequestLine = lineNumber; + mostRecentRequestOffest = columnNumber; + + return completionResults; + } + catch(ArgumentException e) + { + // Bad completion results could return an invalid + // replacement range, catch that here + Logger.Write( + LogLevel.Error, + $"Caught exception while trying to create CompletionResults:\n\n{e.ToString()}"); + } } + + // If all else fails, return empty results + return new CompletionResults(); } ///