v1.18.2681.0 breaks Powershell/WSL2/Commandline Shell (only tested on 23H2 (10.0.22631.2361)) (error 2147942487 (0x80070057)) #20568

Closed
opened 2026-01-31 07:17:46 +00:00 by claunia · 39 comments
Owner

Originally created by @sjansen1 on GitHub (Sep 28, 2023).

Originally assigned to: @lhecker on GitHub.


Important

📌 Pinned comment: https://github.com/microsoft/terminal/issues/16051#issuecomment-1764546234
Are you seeing this issue? If you are, please go try the above comment to help debug. Thanks!


Windows Terminal version

1.18.2681.0

Windows build number

10.0.22631.2361

Other Software

N/A

Steps to reproduce

Starting Terminal or Open Tabs with Powershell, WSL2 or Commandline.

Expected Behavior

Starting the corosponding shell.

Actual Behavior

Starting windows-terminal with powershell end in "error 8009001d loading managed Powershell" (translated from german error message).

Starting WSL tab end in error in RPC Call Error code: Wsl/Service/0x8007072c

Starting Commandline in terminal works, but has a PATH set to (NULL).

Deinstallation of Windows Terminal and downgrade to v1.17.11461.0 fixes this issues. The same happens with latest Preview version i tested after this issue arise.

Originally created by @sjansen1 on GitHub (Sep 28, 2023). Originally assigned to: @lhecker on GitHub. <hr> > [!IMPORTANT] > 📌 Pinned comment: **https://github.com/microsoft/terminal/issues/16051#issuecomment-1764546234** > Are you seeing this issue? If you are, please go try the above comment to help debug. Thanks! <hr> ### Windows Terminal version 1.18.2681.0 ### Windows build number 10.0.22631.2361 ### Other Software N/A ### Steps to reproduce Starting Terminal or Open Tabs with Powershell, WSL2 or Commandline. ### Expected Behavior Starting the corosponding shell. ### Actual Behavior Starting windows-terminal with powershell end in "error 8009001d loading managed Powershell" (translated from german error message). Starting WSL tab end in error in RPC Call Error code: Wsl/Service/0x8007072c Starting Commandline in terminal works, but has a PATH set to (NULL). Deinstallation of Windows Terminal and downgrade to v1.17.11461.0 fixes this issues. The same happens with latest Preview version i tested after this issue arise.
claunia added the Issue-BugIn-PRNeeds-Tag-FixProduct-TerminalPriority-0 labels 2026-01-31 07:17:46 +00:00
Author
Owner

@lhecker commented on GitHub (Sep 28, 2023):

Does the issue happen if you use our portable version from our release page (the .zip files)? https://github.com/microsoft/terminal/releases/tag/v1.18.2681.0

@lhecker commented on GitHub (Sep 28, 2023): Does the issue happen if you use our portable version from our release page (the .zip files)? https://github.com/microsoft/terminal/releases/tag/v1.18.2681.0
Author
Owner

@sjansen1 commented on GitHub (Sep 28, 2023):

@lhecker i uninstall windows-terminal and downloaded and unpacked https://github.com/microsoft/terminal/releases/download/v1.18.2681.0/Microsoft.WindowsTerminal_1.18.2681.0_x64.zip and started WindowsTerminal.exe

Same issue:

Powershell:
Interner Windows PowerShell-Fehler. Fehler 8009001d beim Laden der verwalteten Windows PowerShell.
[Verarbeitung des Prozesses mit Code 4294901760 (0xffff0000) beendet]

WSL:
Der RPC-Aufruf enthält ein Handle, das sich vom deklarierten Handletyp unterscheidet.
Error code: Wsl/Service/0x8007072c

Commandline:
Still missing a hugh amount of environment variables in comparison to a started cmd.exe

@sjansen1 commented on GitHub (Sep 28, 2023): @lhecker i uninstall windows-terminal and downloaded and unpacked https://github.com/microsoft/terminal/releases/download/v1.18.2681.0/Microsoft.WindowsTerminal_1.18.2681.0_x64.zip and started WindowsTerminal.exe Same issue: Powershell: Interner Windows PowerShell-Fehler. Fehler 8009001d beim Laden der verwalteten Windows PowerShell. [Verarbeitung des Prozesses mit Code 4294901760 (0xffff0000) beendet] WSL: Der RPC-Aufruf enthält ein Handle, das sich vom deklarierten Handletyp unterscheidet. Error code: Wsl/Service/0x8007072c Commandline: Still missing a hugh amount of environment variables in comparison to a started cmd.exe
Author
Owner

@lhecker commented on GitHub (Sep 28, 2023):

Ah I think I have an idea what's going on. Your environment variables are broken.

Can you launch regedit, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and make a screenshot of what you see?

@lhecker commented on GitHub (Sep 28, 2023): Ah I think I have an idea what's going on. Your environment variables are broken. Can you launch `regedit`, navigate to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` and make a screenshot of what you see?
Author
Owner

@sjansen1 commented on GitHub (Sep 28, 2023):

Ah I think I have an idea what's going on. Your environment variables are broken.

Can you launch regedit, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and make a screenshot of what you see?

image

Path is incomplete in the screenshot, it is: C:\Program Files\Amazon Corretto\jdk17.0.8_8\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\VSCodium\bin;C:\Program Files\dotnet;C:\Program Files\Tailscale\

@sjansen1 commented on GitHub (Sep 28, 2023): > Ah I think I have an idea what's going on. Your environment variables are broken. > > Can you launch `regedit`, navigate to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` and make a screenshot of what you see? <img width="1124" alt="image" src="https://github.com/microsoft/terminal/assets/8289580/73c8e9ea-0f76-4219-ac50-329833139cff"> Path is incomplete in the screenshot, it is: C:\Program Files\Amazon Corretto\jdk17.0.8_8\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\VSCodium\bin;C:\Program Files\dotnet\;C:\Program Files\Tailscale\
Author
Owner

@lhecker commented on GitHub (Sep 28, 2023):

And what about the contents of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion? Does it look like this?
image

When you open the permissions dialog here:
image

and you select "Users" does it look like this?
image

@lhecker commented on GitHub (Sep 28, 2023): And what about the contents of `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion`? Does it look like this? ![image](https://github.com/microsoft/terminal/assets/2256941/000440db-a9dc-474f-aff5-a87af3cd664e) When you open the permissions dialog here: ![image](https://github.com/microsoft/terminal/assets/2256941/51edb1fb-09e1-4b07-8273-7b4e02c462b2) and you select "Users" does it look like this? ![image](https://github.com/microsoft/terminal/assets/2256941/4d42d043-b539-4124-b75c-72765de53d34)
Author
Owner

@sjansen1 commented on GitHub (Sep 28, 2023):

image

image

So far it looks similar to your settings.

@sjansen1 commented on GitHub (Sep 28, 2023): <img width="383" alt="image" src="https://github.com/microsoft/terminal/assets/8289580/2f92b1f5-82d7-440f-a33b-b150674257e3"> ![image](https://github.com/microsoft/terminal/assets/8289580/978590c4-e9eb-400c-92c5-dbe4053f27d7) So far it looks similar to your settings.
Author
Owner

@DefectInsect commented on GitHub (Sep 28, 2023):

I have the same issues with the recent release. PATH is Null for CMD and PSCore. PowerShell 5.1 won't start with the aformentioned error. Terminal's completely unusable.

Windows 10 22H2, set to german.

@DefectInsect commented on GitHub (Sep 28, 2023): I have the same issues with the recent release. PATH is Null for CMD and PSCore. PowerShell 5.1 won't start with the aformentioned error. Terminal's completely unusable. Windows 10 22H2, set to german.
Author
Owner

@lhecker commented on GitHub (Sep 28, 2023):

Does one of you feel comfortable to run a piece of C++ code under a debugger on your system?

@lhecker commented on GitHub (Sep 28, 2023): Does one of you feel comfortable to run a piece of C++ code under a debugger on your system?
Author
Owner

@sjansen1 commented on GitHub (Sep 28, 2023):

Does one of you feel comfortable to run a piece of C++ code under a debugger on your system?

MDE is a bit picky with unsigned code, but i can try.

@sjansen1 commented on GitHub (Sep 28, 2023): > Does one of you feel comfortable to run a piece of C++ code under a debugger on your system? MDE is a bit picky with unsigned code, but i can try.
Author
Owner

@sjansen1 commented on GitHub (Sep 28, 2023):

My private machine show the same issue after the update, another machine with 23h2.

@sjansen1 commented on GitHub (Sep 28, 2023): My private machine show the same issue after the update, another machine with 23h2.
Author
Owner

@sayandipdutta commented on GitHub (Oct 2, 2023):

I am facing similar issue with preview version 1.19.2682.0, windows 25951.1010. Any idea on what's going on?

@sayandipdutta commented on GitHub (Oct 2, 2023): I am facing similar issue with preview version 1.19.2682.0, windows 25951.1010. Any idea on what's going on?
Author
Owner

@zadjii-msft commented on GitHub (Oct 2, 2023):

Analyzing a bit, it seems to be that OpenConsole.exe never gets around to trying to start the exe (in procmon, there is no "pwsh" in the entire capture from OpenConsole.exe on a machine where this is broken).

Note that e.g. ./OpenConsole.exe pwsh.exe or similar works ok.

From #16087

@zadjii-msft commented on GitHub (Oct 2, 2023): > Analyzing a bit, it seems to be that OpenConsole.exe never gets around to trying to start the exe (in procmon, there is no "pwsh" in the entire capture from OpenConsole.exe on a machine where this is broken). > > Note that e.g. `./OpenConsole.exe pwsh.exe` or similar works ok. From #16087
Author
Owner

@zadjii-msft commented on GitHub (Oct 2, 2023):

Here's a theory - y'all might be able to get unblocked by setting:

"profiles":
{
    "defaults": 
    {
        "compatibility.reloadEnvironmentVariables": false
    },
    "list":
    [
        // ...
    ]
}

in your settings.json. Now, why that regressed, and seemingly only in 10.0.22631.2361 sure is curious.

If you're seeing this, is your Path under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment a REG_SZ or a REG_EXPAND_SZ?

@zadjii-msft commented on GitHub (Oct 2, 2023): Here's a theory - y'all might be able to get unblocked by setting: ```json "profiles": { "defaults": { "compatibility.reloadEnvironmentVariables": false }, "list": [ // ... ] } ``` in your settings.json. Now, why that regressed, and seemingly only in `10.0.22631.2361` sure is curious. If you're seeing this, is your `Path` under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` a `REG_SZ` or a `REG_EXPAND_SZ`?
Author
Owner

@sjansen1 commented on GitHub (Oct 2, 2023):

If you're seeing this, is your Path under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment a REG_SZ or a REG_EXPAND_SZ?

@zadjii-msft Path is a REG_SZ

Setting "compatibility.reloadEnvironmentVariables": false in settings.json has no effect.

Edit: i have to correct myself, Commandshell and WSL works, Powershell still fails with 8009001d.

@sjansen1 commented on GitHub (Oct 2, 2023): > If you're seeing this, is your `Path` under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` a `REG_SZ` or a `REG_EXPAND_SZ`? @zadjii-msft Path is a REG_SZ **Setting "compatibility.reloadEnvironmentVariables": false** in settings.json has no effect. Edit: i have to correct myself, Commandshell and WSL works, Powershell still fails with 8009001d.
Author
Owner

@cyanite commented on GitHub (Oct 2, 2023):

@zadjii-msft, the addition of "compatibility.reloadEnvironmentVariables": false has the effect that now every new tab you open works fine, just not the initial one (which fails like before). So PowerShell also works, if you just press + after the initial one has failed. All of them do.

As for the registry, it's a REG_EXPAND_SZ key for the affected machine.

@cyanite commented on GitHub (Oct 2, 2023): @zadjii-msft, the addition of `"compatibility.reloadEnvironmentVariables": false` has the effect that now every _new_ tab you open works fine, just not the initial one (which fails like before). So PowerShell also works, if you just press + after the initial one has failed. All of them do. As for the registry, it's a REG_EXPAND_SZ key for the affected machine.
Author
Owner

@sjansen1 commented on GitHub (Oct 2, 2023):

@zadjii-msft, the addition of "compatibility.reloadEnvironmentVariables": false has the effect that now every new tab you open works fine, just not the initial one (which fails like before). So PowerShell also works, if you just press + after the initial one has failed. All of them do.

you are right, opening another powershell tab works.

@sjansen1 commented on GitHub (Oct 2, 2023): > @zadjii-msft, the addition of `"compatibility.reloadEnvironmentVariables": false` has the effect that now every _new_ tab you open works fine, just not the initial one (which fails like before). So PowerShell also works, if you just press + after the initial one has failed. All of them do. you are right, opening another powershell tab works.
Author
Owner

@lhecker commented on GitHub (Oct 3, 2023):

Sorry for the delay, here's the C++ code: https://gist.github.com/lhecker/f0bd197c8aa8ecf1aeb6505115bb7646
It would be very helpful if someone could try to compile and run it under a debugger. It should pause at some point during the execution. A stack trace and maybe a screenshot of the local variables would be nice. 🙂

But yesterday we realized we can also just use a WPR trace (see steps here) to get a hold of the WIL error logs, so if the above doesn't work out (because it's rather cumbersome), there's still another way to go about this.

@lhecker commented on GitHub (Oct 3, 2023): Sorry for the delay, here's the C++ code: https://gist.github.com/lhecker/f0bd197c8aa8ecf1aeb6505115bb7646 It would be very helpful if someone could try to compile and run it under a debugger. It should pause at some point during the execution. A stack trace and maybe a screenshot of the local variables would be nice. 🙂 But yesterday we realized we can also just use a WPR trace ([see steps here](https://github.com/microsoft/terminal/wiki/Toubleshooting-Tips#capturing-a-debug-etl-trace)) to get a hold of the WIL error logs, so if the above doesn't work out (because it's rather cumbersome), there's still another way to go about this.
Author
Owner

@zadjii-msft commented on GitHub (Oct 3, 2023):

Also, squinting at the code:

6489f6b39d/src/inc/til/env.h (L226-L232)

That calls the string version of wil::TryGetEnvironmentVariableW

be13859134/include/wil/win32_helpers.h (L604-L609)

    string_type TryGetEnvironmentVariableW(_In_ PCWSTR key)
    {
        string_type result{};
        THROW_IF_FAILED((wil::TryGetEnvironmentVariableW<string_type, initialBufferLength>(key, result)));
        return result;
    }

So that can throw if we don't find the env var. Then in regenerate, we do:

6489f6b39d/src/inc/til/env.h (L537-L560)

Huh, looks like we get a bunch of variables. I can't help but think one of those blows up in this scenario. The aformentioned script under a debugger might tell us which. But maybe all those need to be try_get or something.

@zadjii-msft commented on GitHub (Oct 3, 2023): Also, squinting at the code: https://github.com/microsoft/terminal/blob/6489f6b39daaef634dd0e56e50afa8866f0103c7/src/inc/til/env.h#L226-L232 That calls the string version of `wil::TryGetEnvironmentVariableW` https://github.com/microsoft/wil/blob/be13859134711a1b1206da484f2f6b8b41feb883/include/wil/win32_helpers.h#L604-L609 ```c++ string_type TryGetEnvironmentVariableW(_In_ PCWSTR key) { string_type result{}; THROW_IF_FAILED((wil::TryGetEnvironmentVariableW<string_type, initialBufferLength>(key, result))); return result; } ``` So that can throw if we don't find the env var. Then in `regenerate`, we do: https://github.com/microsoft/terminal/blob/6489f6b39daaef634dd0e56e50afa8866f0103c7/src/inc/til/env.h#L537-L560 Huh, looks like we `get` a bunch of variables. I can't help but think one of those blows up in this scenario. The [aformentioned](https://github.com/microsoft/terminal/issues/16051#issuecomment-1744790570) script under a debugger might tell us which. But maybe all those need to be `try_get` or something.
Author
Owner

@cyanite commented on GitHub (Oct 10, 2023):

@lhecker, unfortunately I can't compile the cpp code. I never do c++ these days (and never did on Windows), and my installed compiler is from VS 2017, which isn't new enough evidently. I need some assistance, at least, in how to do it.

I did get an ETL trace; not sure if it's useful. I enabled tracing (from admin cmd), started WindowsTerminal.exe (from explorer, non-admin), saw the error (PowerShell did start, but with broken environment), stopped trace and then stopped terminal.

ETL file (zipped, since otherwise it doesn't work): terminal-trace.zip

Meanwhile this problem hit another few co-workers. This time it behaved a bit differently, where a large number, but not all, environment variables were lost, including USERPROFILE. This meant that ~ (for home directory) didn't work, which failed a startup script we have. The workaround helped as before. The same behavior was seen by me when doing the trace above.

@cyanite commented on GitHub (Oct 10, 2023): @lhecker, unfortunately I can't compile the cpp code. I never do c++ these days (and never did on Windows), and my installed compiler is from VS 2017, which isn't new enough evidently. I need some assistance, at least, in how to do it. I did get an ETL trace; not sure if it's useful. I enabled tracing (from admin cmd), started WindowsTerminal.exe (from explorer, non-admin), saw the error (PowerShell did start, but with broken environment), stopped trace and then stopped terminal. ETL file (zipped, since otherwise it doesn't work): [terminal-trace.zip](https://github.com/microsoft/terminal/files/12854817/terminal-trace.zip) Meanwhile this problem hit another few co-workers. This time it behaved a bit differently, where a large number, but not all, environment variables were lost, including USERPROFILE. This meant that ~ (for home directory) didn't work, which failed a startup script we have. The workaround helped as before. The same behavior was seen by me when doing the trace above.
Author
Owner

@lhecker commented on GitHub (Oct 16, 2023):

Unfortunately, the trace doesn't contain any relevant errors.

Fortunately however, the absence of any errors is a pretty good indication for what's going on here. I believe the issue is that you (the affected users) have null bytes in your registry values. In particular, this code is wrong:
f2c3ddd105/src/inc/til/env.h (L340-L343)

It makes 2 mistakes:

  • strip_trailing_null only strips 1 trailing null byte, but there can be arbitrarily many
  • Embedded null bytes are not removed

Because of this, the environment string (double null byte terminated) can be malformed (for instance if a section between two null bytes isn't of the form key=value), or it can end up containing two or more null bytes in the middle due to which CreateProcess thinks the environment string only contains N items, even though it contains way more than that. This observation somewhat supports my hypothesis:

This time it behaved a bit differently, where a large number, but not all, environment variables were lost, including USERPROFILE.

@lhecker commented on GitHub (Oct 16, 2023): Unfortunately, the trace doesn't contain any relevant errors. Fortunately however, the absence of any errors is a pretty good indication for what's going on here. I believe the issue is that you (the affected users) have null bytes in your registry values. In particular, this code is wrong: https://github.com/microsoft/terminal/blob/f2c3ddd10523c146260a259a1c2ee2a85b264be8/src/inc/til/env.h#L340-L343 It makes 2 mistakes: * `strip_trailing_null` only strips 1 trailing null byte, but there can be arbitrarily many * Embedded null bytes are not removed Because of this, the environment string (double null byte terminated) can be malformed (for instance if a section between two null bytes isn't of the form `key=value`), or it can end up containing two or more null bytes in the middle due to which `CreateProcess` thinks the environment string only contains N items, even though it contains way more than that. This observation somewhat supports my hypothesis: > This time it behaved a bit differently, where a large number, but not all, environment variables were lost, including USERPROFILE.
Author
Owner

@lhecker commented on GitHub (Oct 16, 2023):

Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505
If you run it, it should list all environment strings that contain embedded null bytes/characters.

@lhecker commented on GitHub (Oct 16, 2023): Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 If you run it, it should list all environment strings that contain embedded null bytes/characters.
Author
Owner

@sjansen1 commented on GitHub (Oct 16, 2023):

I just run it and this is the result:

.\Get-EnvsWithEmbeddedNull.ps1

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: Path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: PSModulePath
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: PROCESSOR_REVISION
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: JAVA_HOME

I dont know what is wrong with this. I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script.

@sjansen1 commented on GitHub (Oct 16, 2023): I just run it and this is the result: # .\Get-EnvsWithEmbeddedNull.ps1 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: Path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: PSModulePath HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: PROCESSOR_REVISION HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: JAVA_HOME I dont know what is wrong with this. I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script.
Author
Owner

@lhecker commented on GitHub (Oct 16, 2023):

Nice! That means my assumption is most likely correct.

I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script.

How did you edit the value? If you haven't already, try using regedit. In case of something like PROCESSOR_REVISION try typing the REG_SZ value by hand (since it's just 4 characters or something) to ensure that it truly doesn't contain any null characters.

@lhecker commented on GitHub (Oct 16, 2023): Nice! That means my assumption is most likely correct. > I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script. How did you edit the value? If you haven't already, try using `regedit`. In case of something like `PROCESSOR_REVISION` try typing the `REG_SZ` value by hand (since it's just 4 characters or something) to ensure that it truly doesn't contain any null characters.
Author
Owner

@sjansen1 commented on GitHub (Oct 16, 2023):

Nice! That means my assumption is most likely correct.

I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script.

How did you edit the value? If you haven't already, try using regedit. In case of something like PROCESSOR_REVISION try typing the REG_SZ value by hand (since it's just 4 characters or something) to ensure that it truly doesn't contain any null characters.

PATH
C:\Program Files\Amazon Corretto\jdk17.0.8_8\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\VSCodium\bin;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\Program Files\Tailscale;C:\Program Files\PuTTY\

PSModulePath
C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\MicrosoftManagedDesktop\Powershell

PROCESSOR_REVISION
4401

Your script triggers on every zero in finds, if i replace the revision from 4401 to 4411, your script no longer show the reg.

@sjansen1 commented on GitHub (Oct 16, 2023): > Nice! That means my assumption is most likely correct. > > > I removeed PROCESSOR_REVISION and recreated it with the same value, it still show up in your script. > > How did you edit the value? If you haven't already, try using `regedit`. In case of something like `PROCESSOR_REVISION` try typing the `REG_SZ` value by hand (since it's just 4 characters or something) to ensure that it truly doesn't contain any null characters. PATH C:\Program Files\Amazon Corretto\jdk17.0.8_8\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\VSCodium\bin;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\Tailscale\;C:\Program Files\PuTTY\ PSModulePath C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\MicrosoftManagedDesktop\Powershell PROCESSOR_REVISION 4401 Your script triggers on every zero in finds, if i replace the revision from 4401 to 4411, your script no longer show the reg.
Author
Owner

@lhecker commented on GitHub (Oct 16, 2023):

Oh I see... That's because I tested my script on PowerShell 7 (pwsh.exe) and you probably use PowerShell 5 (powershell.exe). The fix is to use Contains("`0") instead of Contains(0). I've updated the script above with the fix. Can you test it again?
(I've marked our comments as resolved to make this issue more compact.)

@lhecker commented on GitHub (Oct 16, 2023): Oh I see... That's because I tested my script on PowerShell 7 (`pwsh.exe`) and you probably use PowerShell 5 (`powershell.exe`). The fix is to use ``Contains("`0")`` instead of `Contains(0)`. I've updated the script above with the fix. Can you test it again? (I've marked our comments as resolved to make this issue more compact.)
Author
Owner

@cyanite commented on GitHub (Oct 18, 2023):

@lhecker bingo! That's the problem. The "lovely" tool Snow Inventory Manager, that my company uses, has a NUL:

C:\src # ~\check.ps1
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: SNOW_INVENTORY_HOME

With the value:

C:\Program Files\INVENTORYCLIENT믃蔟℀退幠˕幠˕ etc. etc. 

Obviously only the part before the Hanzi makes it into the environment variable itself.

@cyanite commented on GitHub (Oct 18, 2023): @lhecker bingo! That's the problem. The "lovely" tool Snow Inventory Manager, that my company uses, has a NUL: C:\src # ~\check.ps1 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: SNOW_INVENTORY_HOME With the value: C:\Program Files\INVENTORYCLIENT믃蔟℀退幠˕幠˕ etc. etc. Obviously only the part before the Hanzi makes it into the environment variable itself.
Author
Owner

@lhecker commented on GitHub (Oct 18, 2023):

Thanks for confirming this! I've been rewriting the environment-reload code the last few days (twice as fast, half the code 🎉) and I've got a patch ready to hotfix it in the already released 1.18 branch.

@lhecker commented on GitHub (Oct 18, 2023): Thanks for confirming this! I've been rewriting the environment-reload code the last few days (twice as fast, half the code 🎉) and I've got a patch ready to hotfix it in the already released 1.18 branch.
Author
Owner

@zadjii-msft commented on GitHub (Oct 18, 2023):

We could almost definitely release #16190 in a Canary build just to have folks in this thread double-check it before we service it to the rest of the stable population.

@zadjii-msft commented on GitHub (Oct 18, 2023): We could almost definitely release #16190 in a Canary build just to have folks in this thread double-check it before we service it to the rest of the stable population.
Author
Owner

@JaredChilders commented on GitHub (Oct 18, 2023):

I've been getting this same issue, only when I open Windows Terminal. For some reason the terminal is having trouble connecting to Ubuntu and Powershell instance. But if I open the standalone Powershell terminal and standalone Ubuntu terminal, things run fine.

Ubuntu in Windows Terminal
image

Powershell in Windows Terminal
image

@JaredChilders commented on GitHub (Oct 18, 2023): I've been getting this same issue, only when I open Windows Terminal. For some reason the terminal is having trouble connecting to Ubuntu and Powershell instance. But if I open the standalone Powershell terminal and standalone Ubuntu terminal, things run fine. Ubuntu in Windows Terminal ![image](https://github.com/microsoft/terminal/assets/9031951/cd4e981c-05fa-41cb-9340-bd7d25b9863d) Powershell in Windows Terminal ![image](https://github.com/microsoft/terminal/assets/9031951/6b950667-a307-4196-8e73-cb346317a909)
Author
Owner

@igshipilov commented on GitHub (Oct 20, 2023):

Here's a theory - y'all might be able to get unblocked by setting:

"profiles":
{
    "defaults": 
    {
        "compatibility.reloadEnvironmentVariables": false
    },
    "list":
    [
        // ...
    ]
}

in your settings.json. Now, why that regressed, and seemingly only in 10.0.22631.2361 sure is curious.

If you're seeing this, is your Path under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment a REG_SZ or a REG_EXPAND_SZ?

I have the same problem:

Error code: Wsl/Service/0x8007072c

[process exited with code 4294967295 (0xffffffff)]

If I have REG_EXPAND_SZ, what should I do then?
path
WSL error

Note: same as @cyanite – only initial window throws these errors, but any further windows opened by '+' symbol works fine after adding:
"compatibility.reloadEnvironmentVariables": false in settings.json in Windows Terminal setting

@igshipilov commented on GitHub (Oct 20, 2023): > Here's a theory - y'all might be able to get unblocked by setting: > > ```json > "profiles": > { > "defaults": > { > "compatibility.reloadEnvironmentVariables": false > }, > "list": > [ > // ... > ] > } > ``` > > in your settings.json. Now, why that regressed, and seemingly only in `10.0.22631.2361` sure is curious. > > If you're seeing this, is your `Path` under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` a `REG_SZ` or a `REG_EXPAND_SZ`? I have the same problem: ``` Error code: Wsl/Service/0x8007072c [process exited with code 4294967295 (0xffffffff)] ``` If I have `REG_EXPAND_SZ`, what should I do then? ![path](https://github.com/microsoft/terminal/assets/57264879/12f95bc1-3f48-46ba-8d86-7af768c43fa9) ![WSL error](https://github.com/microsoft/terminal/assets/57264879/cf0d7df8-c783-4026-8da8-8d794e5d52e5) Note: same as @cyanite – only initial window throws these errors, but any further windows opened by '+' symbol works fine after adding: ` "compatibility.reloadEnvironmentVariables": false` in settings.json in Windows Terminal setting
Author
Owner

@bjarne-gram commented on GitHub (Oct 23, 2023):

@lhecker bingo! That's the problem. The "lovely" tool Snow Inventory Manager, that my company uses, has a NUL:

C:\src # ~\check.ps1
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: SNOW_INVENTORY_HOME

With the value:

C:\Program Files\INVENTORYCLIENT믃蔟℀退幠˕幠˕ etc. etc. 

Obviously only the part before the Hanzi makes it into the environment variable itself.

Same issue here, but no chinese charachters.

I just copied the value from the SNOW_INVENTORY_HOME variable into Notepad and copied and pasted it back into RegEdit, and voila - it worked - for me anyway...

@bjarne-gram commented on GitHub (Oct 23, 2023): > @lhecker bingo! That's the problem. The "lovely" tool Snow Inventory Manager, that my company uses, has a NUL: > > ``` > C:\src # ~\check.ps1 > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment: SNOW_INVENTORY_HOME > ``` > > With the value: > > ``` > C:\Program Files\INVENTORYCLIENT믃蔟℀退幠˕幠˕ etc. etc. > ``` > > Obviously only the part before the Hanzi makes it into the environment variable itself. Same issue here, but no chinese charachters. I just copied the value from the SNOW_INVENTORY_HOME variable into Notepad and copied and pasted it back into RegEdit, and voila - it worked - for me anyway...
Author
Owner

@wisewtf commented on GitHub (Oct 25, 2023):

Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 If you run it, it should list all environment strings that contain embedded null bytes/characters.

This solved it for me.

In my case it was the Innovaphone MyApps SDK libraries that updated two env variables LIBJABRA_TRACE_LEVEL and LIBYEALINK_TRACE_LEVEL with null bytes

@wisewtf commented on GitHub (Oct 25, 2023): > Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 If you run it, it should list all environment strings that contain embedded null bytes/characters. This solved it for me. In my case it was the Innovaphone MyApps SDK libraries that updated two env variables `LIBJABRA_TRACE_LEVEL` and `LIBYEALINK_TRACE_LEVEL` with null bytes
Author
Owner

@mutr87 commented on GitHub (Nov 2, 2023):

Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 If you run it, it should list all environment strings that contain embedded null bytes/characters.

This solved it for me.

In my case it was the Innovaphone MyApps SDK libraries that updated two env variables LIBJABRA_TRACE_LEVEL and LIBYEALINK_TRACE_LEVEL with null bytes

Same solution for me:
HKEY_CURRENT_USER\Environment: LIBJABRA_TRACE_LEVEL was causing the issue. (I also have innovaphone MyApps installed)
Opened it in regedit and just saved the value again - Terminal workl again without issues!

@mutr87 commented on GitHub (Nov 2, 2023): > > Based on this idea I've written this PowerShell script: https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505 If you run it, it should list all environment strings that contain embedded null bytes/characters. > > This solved it for me. > > In my case it was the Innovaphone MyApps SDK libraries that updated two env variables `LIBJABRA_TRACE_LEVEL` and `LIBYEALINK_TRACE_LEVEL` with null bytes Same solution for me: HKEY_CURRENT_USER\Environment: LIBJABRA_TRACE_LEVEL was causing the issue. (I also have innovaphone MyApps installed) Opened it in regedit and just saved the value again - Terminal workl again without issues!
Author
Owner

@lnorton89 commented on GitHub (Nov 2, 2023):

Can we get a fix for this? Running the above PowerShell script did nothing.

@lnorton89 commented on GitHub (Nov 2, 2023): Can we get a fix for this? Running the above PowerShell script did nothing.
Author
Owner

@bjarnegram commented on GitHub (Nov 3, 2023):

Can we get a fix for this? Running the above PowerShell script did nothing.

The script doesn't solve the problem, it lists Environment Variables with NULL values. As mentioned above, open the value in RegEdit and save it again, and you're good.

That said - I agree - we should have a fix!

@bjarnegram commented on GitHub (Nov 3, 2023): > Can we get a fix for this? Running the above PowerShell script did nothing. The script doesn't solve the problem, it lists Environment Variables with NULL values. As mentioned above, open the value in RegEdit and save it again, and you're good. That said - I agree - we should have a fix!
Author
Owner

@lnorton89 commented on GitHub (Nov 3, 2023):

Hey use our brand spankin' new Terminal that breaks when we decide it should!

Isn't Billy G paying ya'll? Jesus.

@lnorton89 commented on GitHub (Nov 3, 2023): > Hey use our brand spankin' new Terminal that breaks when we decide it should! Isn't Billy G paying ya'll? Jesus.
Author
Owner

@wisewtf commented on GitHub (Nov 3, 2023):

lnorton89
Isn't Billy G paying ya'll? Jesus.

There's a commit to fix this error already, if you've bothered reading this issue, at all.

@wisewtf commented on GitHub (Nov 3, 2023): > [lnorton89](/lnorton89) > Isn't Billy G paying ya'll? Jesus. There's a commit to fix this error already, if you've bothered reading this issue, at all.
Author
Owner

@lnorton89 commented on GitHub (Nov 3, 2023):

Great, when would production users see this? 30+ days out from initial problems.

@lnorton89 commented on GitHub (Nov 3, 2023): Great, when would production users see this? 30+ days out from initial problems.
Author
Owner

@zadjii-msft commented on GitHub (Nov 3, 2023):

Y'all are getting a little spicy in here. Too spicy for before the morning coffee pot. We're working on minting a fresh servicing build and rolling that out to the Store. Probably in the coming days. Thanks for your patience.

@zadjii-msft commented on GitHub (Nov 3, 2023): Y'all are getting a little spicy in here. Too spicy for before the morning coffee pot. We're working on minting a fresh servicing build and rolling that out to the Store. Probably in the coming days. Thanks for your patience.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20568