vscode icon indicating copy to clipboard operation
vscode copied to clipboard

PowerShell Integrated Terminal Crashes when Changing Folders

Open Wolveraptor opened this issue 9 months ago • 3 comments

Type: Bug

Steps to reproduce:

  • Ensure you have have opened two separate Git repositories both with the integrated PowerShell terminal loaded first! This is required so that PowerShell attempts to automatically open each time you open a new Git folder.
  • Open Visual Studio Code.
  • Open a folder with a Git repository.
  • PowerShell integrated terminal will stay open.
  • Open another folder with Git repository.
  • PowerShell integrated terminal crashes with the error: "The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" terminated with exit code: -1073741510."

Have tried:

  • Disabling all Visual Studio Code extensions.
  • Removing all Visual Studio Code "@modified" settings.
  • Deleting the "C:\Users<UserName>\AppData\Roaming\Code' folder.

Notes:

  • Downgrading to Visual Studio Code 1.97.2 on Windows 11 24H2 seems to work.
  • Visual Studio Code 1.98.0 does not have the same issue when on Windows 11 23H2.

Issue occurs when:

  • Using Windows 11 24H2 and Visual Studio Code 1.98.0

Isse does not occur when:

  • Using Windows 11 24H2 and Visual Studio Code 1.97.2
  • Using Windows 11 23H2 and Visual Studio Code 1.98.0

VS Code version: Code 1.98.0 (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z) OS version: Windows_NT x64 10.0.26100 Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i9-13900K (32 x 2995)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.72GB (52.90GB free)
Process Argv --crash-reporter-id 5dc200e8-363d-4d5f-8dc6-63a69f76ed42
Screen Reader no
VM 0%
Extensions (4)
Extension Author (truncated) Version
debugpy ms- 2025.4.0
python ms- 2025.2.0
vscode-pylance ms- 2025.3.1
powershell ms- 2025.0.0

Wolveraptor avatar Mar 06 '25 23:03 Wolveraptor

I also encountered this problem,

My system information

版本: 1.98.0 (user setup) 提交: 6609ac3d66f4eade5cf376d1cb76f13985724bcb 日期: 2025-03-04T21:06:18.612Z Electron: 34.2.0 ElectronBuildId: 11044223 Chromium: 132.0.6834.196 Node.js: 20.18.2 V8: 13.2.152.36-electron.0 OS: Windows_NT x64 10.0.26100

Wangijun avatar Mar 07 '25 00:03 Wangijun

This extension issue might also be related: https://github.com/nguyenngoclongdev/vs-terminal-keeper/issues/52

xgdgsc avatar Mar 07 '25 03:03 xgdgsc

I also encountered the same problem. When I opened a project, the terminal would crash when it was automatically started. When I closed all terminals and opened a pwsh, it would also crash. However, it would not crash if I opened it again after a few seconds.

anak1st avatar Mar 07 '25 10:03 anak1st

Experiencing this problem as well, Windows 11 24H2, VS Code 1.98.0

nvzoll avatar Mar 08 '25 12:03 nvzoll

Does this occur if you use Powershell vs windows powershell? The latter has performance issues and we suggest using the former.

meganrogge avatar Mar 10 '25 17:03 meganrogge

@meganrogge I use powershell 7.5.0 installed from github release executable (reinstalled, before it was winget installation, nothing changed for me, the issue persists)

nvzoll avatar Mar 10 '25 18:03 nvzoll

does changing terminal.integrated.windowsUseConptyDll fix it?

meganrogge avatar Mar 10 '25 19:03 meganrogge

@meganrogge with some brief testing, it seems that the dll option does fix it.

nvzoll avatar Mar 10 '25 19:03 nvzoll

@meganrogge, I am confirming that changing terminal.integrated.windowsUseConptyDll resolves the terminal crashing when changing folders.

Regarding Windows PowerShell/PowerShell versions, I only have Windows PowerShell 5.1 installed. The terminal.integrated.windowsUseConptyDll fix works with Windows PowerShell 5.1.

Wolveraptor avatar Mar 11 '25 13:03 Wolveraptor

Can users check if the issue is fixed in latest insiders https://code.visualstudio.com/insiders with "terminal.integrated.windowsUseConptyDll": false setting ?

If it works, the fix will be backported as candidate to 1.98.2 release. Thanks!

deepak1556 avatar Mar 12 '25 10:03 deepak1556

Do you need us to manually add that setting? Or are you saying its already set to 'false'? I'm testing it right now, and seems fixed (didn't try to set that setting).

unsivilaudio avatar Mar 12 '25 11:03 unsivilaudio

@unsivilaudio please add that setting, the default with insiders is true

deepak1556 avatar Mar 12 '25 12:03 deepak1556

@deepak1556 , the issue does NOT occur with "terminal.integrated.windowsUseConptyDll": false or "terminal.integrated.windowsUseConptyDll": true on Visual Studio Code Insiders.

Image

Is there anything else you need tested?

Wolveraptor avatar Mar 12 '25 14:03 Wolveraptor

Thanks for testing, this is good enough to confirm the fix. Closing for release verification from our side.

deepak1556 avatar Mar 12 '25 15:03 deepak1556

Steps for verification:

  1. Ensure the setting "terminal.integrated.windowsUseConptyDll": false
  2. Open a powershell terminal
  3. Kill the terminal with the trash icon
  4. Attempt to open a new terminal immediately
  5. With 1.98.0 it should fail with the error "The terminal process ... terminated with exit code: -1073741510."
  6. With sanity build the issue should be fixed

deepak1556 avatar Mar 12 '25 15:03 deepak1556

Those steps do not produce the error for me. Only switching folders (to one with a previously opened terminal, which is what OP was ) produces this issue

The terminal process ... terminated with exit code: -1073741510.

affects all terminal types, not just powershell

Issue does not occur on insider build at all as far as I can tell (regardless of conpty setting). It does occur in release build.

unsivilaudio avatar Mar 12 '25 15:03 unsivilaudio

✅ I can repro on 1.98.1 but not on the 1.98.2 candidate.

joaomoreno avatar Mar 12 '25 15:03 joaomoreno

@deepak1556 , the clarity @unsivilaudio audio provided about the steps to reproduce is correct.

My original steps to reproduce may not be clear so I have attempted to clarify them. Happy to clarify further if needed, just let me know!

  1. Be running Windows 11 24H2 and Visual Studio Code 1.98.0
  2. Open Visual Studio Code.
  3. Open a folder (File -> Open Folder) with a Git repository and launch a terminal (Terminal -> New Terminal) within Visual Studio Code.
  4. Open another folder (File -> Open Folder) with a Git repository and launch a terminal (Terminal -> New Terminal) within Visual Studio Code.
  5. Open the first folder with a Git repository from step 2 with File -> Open Recent.
  6. PowerShell integrated terminal crashes with the error: The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" terminated with exit code: -1073741510."

Wolveraptor avatar Mar 12 '25 15:03 Wolveraptor

Yes, those steps produce that error on 1.98.1, not on insider (1.99.0). The conpty setting true/false does not matter on insider, no terminal crash regardless.

unsivilaudio avatar Mar 12 '25 15:03 unsivilaudio