microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.88k stars 29.16k forks source link

Temp output of Write-Progress is not removed correctly and blends into the main output (making the output unusable) #118661

Closed DEberhardt closed 3 years ago

DEberhardt commented 3 years ago

Issue Type: Bug

  1. Execute Script via CmdLine or Run that has Write-Progress in it.
  2. Terminal output does not correctly remove the Progress. and leaves the "overlay" on screen leaving the output incomplete or worse incorrect.

Detail

Executing Write-Progress in the VsCode Integrated Terminal window leaves Progress window drawn in the terminal overlaying the actual output below.

First I thought that it occurs when followed by a ForEach where the Progress is written with the Same ID or one higher, but that is not the case. Then I investigated whether my scripts are missing the Write-Progress [...] -Completed message at the end - they do not (even when they are missing (shame on me!) the windows are not correctly removed. Adding the -Complete Step at the end does not make a difference). The Progress window is expected to be removed. This behaviour is correct in PowerShell and PowerShell ISE, but not in VSCode.

Not all of them display the same behaviour though. My Module makes heavy use of Write-Progress to indicate, well, progress, especially for longer running tasks. image

Affected Scripts (Module TeamsFunctions)

Extensions

Does this issue occur when all extensions are disabled?: Yes

Testing with Extension Bisect has yielded the following result:

Relevant Settings

User Settings, Workspace settings are not used, nor are Folder Settings - these are all settings with the Word Terminal in it^^

    "terminal.integrated.confirmOnExit": true,
    "terminal.integrated.cursorStyle": "underline",
    "terminal.integrated.fontFamily": "Cascadia Code PL, Consolas, 'Courier New', monospace",
    "terminal.integrated.fontWeight": 300,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "workbench.colorCustomizations": {
        "errorLens.errorBackground": "#e4545410",
        "errorLens.errorForeground": "#ff646440",
        "errorLens.errorMessageBackground": "#e4545405",
        "errorLens.warningBackground": "#ff942f10",
        "errorLens.warningForeground": "#fa973a70",
        "errorLens.warningMessageBackground": "#fff00005",
        "terminal.ansiBlack": "#000000",
        "terminal.ansiBlue": "#2472c8",
        "terminal.ansiBrightBlack": "#666666",
        "terminal.ansiBrightBlue": "#569cd6",
        "terminal.ansiBrightCyan": "#9cdcfe",
        "terminal.ansiBrightGreen": "#b5cea8",
        "terminal.ansiBrightMagenta": "#daadd6",
        "terminal.ansiBrightRed": "#f14c4c",
        "terminal.ansiBrightWhite": "#e5e5e5",
        "terminal.ansiBrightYellow": "#DCDCAA",
        "terminal.ansiCyan": "#11a8cd",
        "terminal.ansiGreen": "#6a9955",
        "terminal.ansiMagenta": "#C586C0",
        "terminal.ansiRed": "#cd3131",
        "terminal.ansiWhite": "#e5e5e5",
        "terminal.ansiYellow": "#CE9178",
        "terminal.background": "#1E1E1E",
        "terminal.foreground": "#D4D4D4"
    },

I do not know why (when I start vscode) I have two integrated shells running, but both are v5 (which I need due to incompatibilities with v7)

PowerShell 5 information

PSVersion: 5.1.19041.610 PSEdition: Desktop PSCompatibleVersions: {1.0, 2.0, 3.0, 4.0...} BuildVersion: 10.0.19041.610 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1

VS Code version: Code 1.54.1 (f30a9b73e8ffc278e71575118b6bf568f04587c8, 2021-03-04T22:38:31.419Z) OS version: Windows_NT x64 10.0.19042

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz (8 x 2112)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.82GB (2.65GB free)| |Process Argv|--crash-reporter-id f27f9bb3-e891-47b2-97df-ee4161a60956| |Screen Reader|no| |VM|0%|
Extensions (51) Extension|Author (truncated)|Version ---|---|--- vscode-color|ans|0.4.5 psrule-vscode-preview|bew|0.17.0 emojisense|bie|0.8.0 markdown-checkbox|bie|0.1.3 LinkCheckMD|bla|0.3.1 vscode-tldr|bmu|1.0.0 bracket-pair-colorizer-2|Coe|0.2.0 vscode-github-actions|csc|0.17.0 vscode-markdownlint|Dav|0.39.0 docs-article-templates|doc|0.2.11 docs-authoring-pack|doc|0.1.13 docs-build|doc|0.3.2 docs-images|doc|0.0.9 docs-linting|doc|0.0.6 docs-markdown|doc|0.2.84 docs-metadata|doc|1.0.6 docs-preview|doc|0.3.57 docs-scaffolding|doc|0.0.2 docs-yaml|doc|0.2.6 vscode-PSStackoverflow|Dou|0.0.2 gitlens|eam|11.3.0 vs-code-xml-format|fab|0.1.5 vscode-open-multiple-files|fab|1.3.0 markdown-table-formatter|fcr|2.1.4 vscode-pull-request-github|Git|0.24.0 gc-excelviewer|Gra|3.0.41 todo-tree|Gru|0.0.202 vscode-test-explorer|hbe|2.19.5 vscode-drawio|hed|1.3.0 vscode-peacock|joh|3.9.1 powershell-extension-pack|jus|0.0.4 vscode-github|Kni|0.30.4 regexp-preview|Lou|0.1.5 git-graph|mhu|1.29.0 js-debug-nightly|ms-|2021.3.917 powershell-preview|ms-|2021.2.1 vsliveshare-pack|ms-|0.4.0 indent-rainbow|ode|7.5.0 vscode-yaml|red|0.16.0 vscode-sort-json|ric|1.19.2 vscode-markdown-table-sort|sim|1.0.4 vscode-zipexplorer|sle|0.3.1 code-spell-checker|str|1.10.2 vscode-pester-test-adapter|Tyl|0.0.21 errorlens|use|3.2.4 vscode-icons|vsc|11.1.0 codetour|vsl|0.0.46 gistfs|vsl|0.2.2 gitdoc|vsl|0.0.7 better-align|wwm|1.1.6 markdown-all-in-one|yzh|3.4.0
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstry914:30256638 pythonvsdeb440:30248342 pythonvsded773:30248341 pythonvspyt875:30259475 dockersubsetcf:30265999 pythontbcf:30265426 vspre833:30267464 ```
Tyriar commented 3 years ago

This issue seems to originate from an upstream component and is not something VSCode can fix by making a change to our code. As such, I will go ahead and close it. Please try to reproduce in Windows Terminal and report to microsoft/terminal with repro steps.

Thanks for understanding.

/label upstream terminal terminal-conpty

DEberhardt commented 3 years ago

Hello, may I inquire which component this is and where the appropriate place would be to file this?

Thank you, David

Tyriar commented 3 years ago

I actually updated my saved reply the other day to clarify this, hopefully this will answer:

This issue seems to originate from an upstream component and is not something VSCode can fix by making a change to our code. As such, I will go ahead and close it. Please try to reproduce in Windows Terminal and report to microsoft/terminal with repro steps.

If you cannot reproduce in Windows Terminal, chances are it's fixed in a later version of Windows. You can read more about how we consume conpty here. Thanks for understanding.

DEberhardt commented 3 years ago

I have done some testing and could not reproduce it in VsCode on Windows 11 - Then I tested other commands and found it still does. Comparing both commands, I could pinpoint the issue:

This will jumble up the output:

      Write-Progress -Id 1 -Status "Processing '$($ResourceAccount.UserPrincipalName)'" -Activity $MyInvocation.MyCommand -Completed
      Write-Output $ResourceAccountObject
      Write-Progress -Id 0 -Status 'Information Gathering' -Activity $MyInvocation.MyCommand -Completed

this will not:

      Write-Progress -Id 1 -Status "Processing '$($ResourceAccount.UserPrincipalName)'" -Activity $MyInvocation.MyCommand -Completed
      Write-Progress -Id 0 -Status 'Information Gathering' -Activity $MyInvocation.MyCommand -Completed
      Write-Output $ResourceAccountObject

I will fix my scripts and thank you for your time.

For reference, this is only affecting VScode Terminal though, not Windows Terminal, not ISE and not the PowerShell window (v5.1)

Version: 1.61.2 (user setup) Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643 Date: 2021-10-19T14:57:20.575Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000