PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Error deployment arm template with AZ powershell System.ArgumentOutOfRangeException:

Open RoyKimYYZ opened this issue 7 years ago • 4 comments

Attempted to run this

Error: System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.

Ran the following: $resourceGroupDeployment = New-AzResourceGroupDeployment -Name $armTemplateName'-Deployment' -ResourceGroupName $resourceGroupName -TemplateFile .\keyvault-azurecontainerregistry-armdeploy.json -TemplateParameterFile .\keyvault-azurecontainerregistry-armdeploy.parameters.json -location 'Canada Central' -acrName $acrName -keyVaultName $keyVaultName -objectId $keyVaultADGroupServicePrincipalObjectId -tenantId $tenantId -roleNameGuid $roleNameGuid -DeploymentDebugLogLevel All -Mode Incremental

Last 200 Keys: e Space $ a c r N a m e Space Enter Space - k e y V a u l t N a m e Space $ k e y V a u l t N a m e Space Enter Space - o b j e c t I d Space $ k e y V a u l t A D G r o u p S e r v i c e P r i n c i p a l O b j e c t I d Space Enter Space - t e n a n t I d Space $ t e n a n t I d Space Enter Space - r o l e N a m e G u i d Space $ r o l e N a m e G u i d Space ` Enter Space - D e p l o y m e n t D e b u g L o g L e v e l Space A l l Space - M o d e Space I n c r e m e n t a l Enter

Exception: System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. Parameter name: top Actual value was -1. at System.Console.SetCursorPosition(Int32 left, Int32 top) at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor) at Microsoft.PowerShell.PSConsoleReadLine.ForceRender() at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

RoyKimYYZ avatar Oct 28 '19 03:10 RoyKimYYZ

You didn't provide any environment data, but almost certainly this has been fixed in 2.0.0-beta5. Please give it a try.

msftrncs avatar Oct 28 '19 05:10 msftrncs

I’m new with submitting issues. What kind of environment data?

Like OS? And powershell version?

I think I resolved the issue by executing clear-azcontext if that makes sense.

I don’t want to install any betas at the moment.

Sent from my iPhone

On Oct 28, 2019, at 1:12 AM, Carl Morris <[email protected]mailto:[email protected]> wrote:

You didn't provide any environment data, but almost certainly this has been fixed in 2.0.0-beta5. Please give it a try.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/PowerShell/PSReadLine/issues/1136?email_source=notifications&email_token=AAO6JIRTSPAQL4H3PGAXB7TQQZYCNA5CNFSM4JFU76H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECLWQTQ#issuecomment-546793550, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAO6JIXLRXP3GHTGX7MWMYLQQZYCNANCNFSM4JFU76HQ.

RoyKimYYZ avatar Oct 28 '19 12:10 RoyKimYYZ

The following script from the 'new issue template' provides the needed environment data:

& {
    $hostName = $Host.Name
    if ($hostName -eq "ConsoleHost" -and (Get-Command Get-CimInstance -ErrorAction SilentlyContinue)) {
        $id = $PID
        $inWindowsTerminal = $false
        while ($true) {
            $p = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId Like $id"
            if (!$p -or !$p.Name) { break }
            if ($p.Name -eq "WindowsTerminal.exe") { $inWindowsTerminal = $true; break }
            $id = $p.ParentProcessId
        }
        if ($inWindowsTerminal) { $hostName += " (Windows Terminal)" }
    }

    "`nPS version: $($PSVersionTable.PSVersion)"
    $v = (Get-Module PSReadline).Version
    $m = Get-Content "$(Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
    if ($m) {
        $v = "$v-" + $m.Matches[0].Groups[1].Value
    }
    "PSReadline version: $v"
    if ($IsLinux -or $IsMacOS) {
        "os: $(uname -a)"
    } else {
        "os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
    }
    "PS file version: $($name = if ($PSVersionTable.PSEdition -eq "Core") { "pwsh.dll" } else { "powershell.exe" }; (dir $pshome\$name).VersionInfo.FileVersion)"
    "HostName: $hostName"
    "BufferWidth: $([console]::BufferWidth)"
    "BufferHeight: $([console]::BufferHeight)`n"
}

More than likely you are already running a beta version of PSReadLine, as recent version of PowerShell and Windows PowerShell comes with it prepackaged. Beta5 is now probably the most stable version of recent history.

msftrncs avatar Oct 28 '19 17:10 msftrncs

Please try out the 2.0.0-beta5 version of PSReadLine from PowerShellGallery.

daxian-dbw avatar Nov 11 '19 22:11 daxian-dbw