vscode-powershell: Hangs on ArgumentCompleter Debugging

Example Code:

using namespace System.Management.Automation
$MSIHelper = {
    param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)

    if ($GLOBAL:ACDebug) {
        $CommandName | Write-Host -fore darkgreen
        $ParameterName | Write-Host -fore darkcyan
        $wordToComplete | Write-Host -fore darkyellow
        $commandAst | ft | Out-String | Write-Host -fore magenta
        $fakeBoundParameters | ft | out-string | write-host -fore green
    }
    [CompletionResult]::new(
        'test', #completionText
        'testListItem', #listItemText
        [CompletionResultType]::ParameterValue, #resultType
        'testToolTip' #toolTip
    )
}
Register-ArgumentCompleter -CommandName New-AzureADServiceAppRoleAssignment -ScriptBlock $MSIHelper

When dotsourcing this from a file and then starting interactive debug with F5, upon attempting the completion it starts debug and stops at the correct line and displays all the info, however the console is hung and none of the debug buttons (run, step into/out/etc) work. Stop does work, but the integrated console totally hangs and requires a restart. image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

@andschwa sure, I’ll try tomorrow and update.