Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suddenly unable to launch PowerShell in Windows Terminal via Run/shell #16660

Closed
ninbura opened this issue Feb 4, 2024 · 7 comments
Closed
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@ninbura
Copy link

ninbura commented Feb 4, 2024

Windows Terminal version

1.19.10292.0

Windows build number

10.0.22631.0

Other Software

PowerShell 7 - v7.4.1
PowerShell - v5.1.22621.2506

Steps to reproduce

via run

  1. open Run
  2. input wt pwsh
  3. click "OK"

via shell

  1. open PowerShell, PowerShell 7, or Command Prompt
  2. input wt pwsh or wt PowerShell

nuance

For whatever reason I've found that it is sometimes necessary to run wt [shell] more than once before Windows Terminal will even launch to print the error message. Almost as if Terminal itself is hard crashing before it can display.

Expected Behavior

  1. wt pwsh launches Windows Terminal with the PowerShell 7 profile without error.
  2. wt PowerShell launches Windows Terminal with the PowerShell profile without error.

Actual Behavior

  1. wt pwsh launches Windows Terminal with the PowerShell 7 profile and displays the following error & exit code:
    • Process terminated. The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
         at System.Environment.FailFast(System.String, System.Exception)
         at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
         at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
      System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
      ---> System.ComponentModel.Win32Exception (126): The specified module could not be found.
         at System.Management.Automation.Internal.SecuritySupport.GetSaferPolicy(String path, SafeHandle handle)
         at System.Management.Automation.Security.SystemPolicy.TestSaferPolicy(String testPathScript, String testPathModule)
         at System.Management.Automation.Security.SystemPolicy.GetAppLockerPolicy(String path, SafeHandle handle)
         at System.Management.Automation.Security.SystemPolicy.GetLockdownPolicy(String path, SafeHandle handle)
         at System.Management.Automation.Security.SystemPolicy.GetSystemLockdownPolicy()
         at System.Management.Automation.Runspaces.InitialSessionState..cctor()
         --- End of inner exception stack trace ---
         at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault2()
         at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
      [process exited with code 2148734499 (0x80131623)]
      You can now close this terminal with Ctrl+D, or press Enter to restart.
  2. wt PowerShell launches Windows Terminal with the PowerShell profile and displays the following error & exit code:
    • Internal Windows PowerShell error.  Loading managed Windows PowerShell failed with error 8009001d.
      
      [process exited with code 4294901760 (0xffff0000)]
      You can now close this terminal with Ctrl+D, or press Enter to restart.
@ninbura ninbura added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 4, 2024

This comment was marked as off-topic.

@ninbura
Copy link
Author

ninbura commented Feb 4, 2024

more details

From what I can tell, this started to occur after updating Windows Terminal to version 1.19.10292.0. The issue is replicable on 3 systems that I own, all on different chipsets, but running the same Windows Edition, Version, & OS Build.

  1. Windows Edition - Windows 11 Pro N for Workstations
  2. Windows Version - 23H2
  3. Windows OS Build - 22631.3085

There is another issue on the PowerShell repository (PowerShell/PowerShell#20595) that mentions this same error, but it has been closed as it was mentioned to be an issue with Windows terminal; linking to this #16051. Which has been locked due to participant's "spicy" behavior. However, I'm not sure I have the same issue as running the Get-EnvsWithEmbeddedNull script mentioned in #16051 does not list any corrupt registry entries on any of my 3 systems.

things I've tried

  1. restarting my systems
  2. checking for updates
  3. un-installing & re-installing Windows Terminal via winget
  4. Running the Get-EnvsWithEmbeddedNull script script, as mentioned before.
  5. manually searching registry locations in regedit

@PiTomar
Copy link

PiTomar commented Feb 4, 2024

I guess this is a bug in the v1.19 Release and will be probably fixed in v1.20. See:
https://github.com/microsoft/terminal/releases/tag/v1.20.10303.0

@zadjii-msft
Copy link
Member

Yea pretty sure this is /dup #16623, which is already fixed in v1.19.10302.0

@zadjii-msft zadjii-msft closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 5, 2024
@aaronedev
Copy link

it starts happening for me as well with latest [v1.22.3232.0]

@DHowett
Copy link
Member

DHowett commented Nov 27, 2024

@aaronedev please file a new bug, fill out the template, and include a screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

5 participants