-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).WG-Maintainers-Buildspecific to affecting the buildspecific to affecting the build
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I've installed PowerShell as a global tool with .NET 6 in an Alpine 3.15 container. When attempting to run pwsh, it results in the following error:
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
Cannot load PSReadline module. Console is running without PSReadline.
Process terminated. The type initializer for 'System.Management.Automation.PSObject' 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.PSObject' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
--- End of inner exception stack trace ---
at System.Management.Automation.PSObject.get_Properties()
at System.Management.Automation.HostUtilities.GetDollarProfile(String allUsersAllHosts, String allUsersCurrentHost, String currentUserAllHosts, String currentUserCurrentHost)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceInitialization(Boolean skipProfiles, String initialCommand, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.DoCreateRunspace(String initialCommand, Boolean skipProfiles, Boolean staMode, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.CreateRunspace(Object runspaceCreationArgs)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
Repro Steps:
- Build the following Dockerfile (e.g.
docker build -t test .):
FROM alpine:3.15
RUN apk add --no-cache \
ca-certificates \
\
# .NET dependencies
icu-libs \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
zlib
# Install .NET SDK
RUN wget -O dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-musl-x64.tar.gz \
&& mkdir -p /usr/share/dotnet \
&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
# Install PowerShell
RUN dotnet tool install --global PowerShell
ENTRYPOINT [ "/root/.dotnet/tools/pwsh" ]- Run the container (e.g.
docker run --rm test)
Expected behavior
A successful execution into the shell of PowerShellActual behavior
One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
One or more errors occurred. (The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception.)
Cannot load PSReadline module. Console is running without PSReadline.
Process terminated. The type initializer for 'System.Management.Automation.PSObject' 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.PSObject' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
--- End of inner exception stack trace ---
at System.Management.Automation.PSObject.get_Properties()
at System.Management.Automation.HostUtilities.GetDollarProfile(String allUsersAllHosts, String allUsersCurrentHost, String currentUserAllHosts, String currentUserCurrentHost)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceInitialization(Boolean skipProfiles, String initialCommand, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.DoCreateRunspace(String initialCommand, Boolean skipProfiles, Boolean staMode, String configurationName, Collection`1 initialCommandArgs)
at Microsoft.PowerShell.ConsoleHost.CreateRunspace(Object runspaceCreationArgs)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
### Error details
_No response_
### Environment data
```powershell
Unable to get this data since PowerShell can't be run.
Visuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).WG-Maintainers-Buildspecific to affecting the buildspecific to affecting the build