mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix a null reference crash in completion code (#19916)
This commit is contained in:
@@ -87,4 +87,21 @@ Describe "Tab completion bug fix" -Tags "CI" {
|
||||
$result.CompletionMatches[0].CompletionText | Should -BeExactly 'Ascending'
|
||||
$result.CompletionMatches[1].CompletionText | Should -BeExactly 'Descending'
|
||||
}
|
||||
|
||||
It "Issue#19912 - Tab completion should not crash" {
|
||||
$ISS = [initialsessionstate]::CreateDefault()
|
||||
$Runspace = [runspacefactory]::CreateRunspace($ISS)
|
||||
$Runspace.Open()
|
||||
$OldRunspace = [runspace]::DefaultRunspace
|
||||
try
|
||||
{
|
||||
[runspace]::DefaultRunspace = $Runspace
|
||||
{[System.Management.Automation.CommandCompletion]::CompleteInput('Get-', 3, $null)} | Should -Not -Throw
|
||||
}
|
||||
finally
|
||||
{
|
||||
[runspace]::DefaultRunspace = $OldRunspace
|
||||
$Runspace.Dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user