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

System.Management.Automation not found #1790

Open
4 of 17 tasks
Yucked opened this issue Nov 24, 2021 · 7 comments
Open
4 of 17 tasks

System.Management.Automation not found #1790

Yucked opened this issue Nov 24, 2021 · 7 comments
Labels
Area-PowerShell Specific to PowerShell bug Something isn't working External Impact-Medium

Comments

@Yucked
Copy link

Yucked commented Nov 24, 2021

Describe the bug

Setting up a docker container from scratch using alpine image. Everything builds as shown in the screenshot but whenever I create a new C#/PS notebook, it begins throwing exceptions and whatever is entered in the notebook and ran hangs forever.

File name: 'System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel..ctor()
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.CreateKernel(String defaultKernelName, FrontendEnvironment frontendEnvironment, StartupOptions startupOptions) in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 588
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>g__JupyterHandler|11>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 272
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>b__3>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 218
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
[I 2021-11-24 22:54:42.749 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports

Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

.NET 6 SDK and Runtime is installed. PWSH 7.2.0 is also installed. Both are in path as well.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):
The preview version (1.0.257301) since the one on nuget requires .net 5.

RUN dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive && \
    dotnet interactive jupyter install && \
    mkdir ${NOTEBOOKS_DIR} && \
    ln -s ${PS_LOC}/pwsh /usr/bin/pwsh && \
    ln -s ${DOTNET_ROOT}/dotnet /usr/bin/dotnet
  • OS
    • Windows 11
    • Windows 10
    • macOS
    • Linux (Please specify distro) Alpine:edge
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Visual Studio
    • Other (please specify)

Screenshots

If applicable, add screenshots to help explain your problem.
image
image
image

@m0rphed
Copy link

m0rphed commented Nov 25, 2021

Have the same issue on arch linux with .NET 6 (6.0.100) and aspnet-runtime 6.0.0
'microsoft.dotnet-interactive' (version '1.0.257301')

@Hairo
Copy link

Hairo commented Dec 15, 2021

Same issue for me in EndeavourOS, tried installing powershell (because apparently System.Management.Automation is part of it) and still didn't work.

@ssteck
Copy link

ssteck commented Jan 12, 2022

I am also seeing this issue in AlamaLinux 8 with dotnet-interactive version 1.0.260601+9d1ecd3c06ba93e59bfef3842d2660c08d9e2ce5. I have ensured that powershell 7.2.0 is installed and launches successfully. I am seeing this error both when trying to use botnet-interactive with a jupyter notebook as well as just launching dotnet-interactive stdio

One thing I noticed is that the error being thrown is for System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 while the only available 7.2.0 PowerShell package from the Microsoft repository includes System.Management.Automation, Version=7.2.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35 I don't know if it is possible to get the 7.2.0.0 DLL from somewhere or if that might be the issue.

@jonsequitur jonsequitur added Area-PowerShell Specific to PowerShell Impact-Medium bug Something isn't working labels Feb 22, 2022
@maurictg
Copy link

Same problem on Arch
Are there any updates on this?

@tulx17
Copy link

tulx17 commented Aug 3, 2022

For Arch user, use the sdk build from AUR, it's newer than the community version. I don't know why but this do the trick.

@rayhernandez
Copy link

rayhernandez commented Oct 12, 2022

I had the same error:

Failed to start the Kernel.

Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'System.Management.Automation, Version=7.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Thanks for the tip @tunbk1002. I was finally able to fix this on Manjaro. I downloaded these from the AUR:

aur/dotnet-host-bin                 6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-runtime-bin              6.0.3.sdk201-1         6.0.4.sdk202-1
aur/netstandard-targeting-pack-bin  6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-targeting-pack-bin       6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-sdk-bin                  6.0.3.sdk201-1         6.0.4.sdk202-1 

@obratim
Copy link

obratim commented Aug 3, 2024

It is an issue in Microsoft.PowerShell.SDK package.

System.Management.Automation is stored in same git repository and is referenced as project, not as a package. As the result in the nuspec file written that it depends on a one version of System.Management.Automation, but inside nupkg archive under ref/net8.0/ there is another version of System.Management.Automation.dll.

This confusion causes error.

Reported a bug: PowerShell/PowerShell#24110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-PowerShell Specific to PowerShell bug Something isn't working External Impact-Medium
Projects
None yet
Development

No branches or pull requests

9 participants