PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 490 forks source link

[Preview] Clean Preview install on Windows 2016 - Exception encountered starting EditorServices #2393

Closed PrzemyslawKlys closed 4 years ago

PrzemyslawKlys commented 4 years ago

Issue Description

I am experiencing a problem with...

Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\
PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line
221 in EndProcessing:
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFo
undException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Cul
ture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The s
ystem cannot find the file specified.
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadEdito
rServices()
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.<LoadAndR
unEditorServicesAsync>d__9.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceled
Exceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationTo
ken cancellationToken)
   at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.En
dProcessing()
---> (Inner Exception #0) System.IO.FileNotFoundException: Could not load file o
r assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13
ffcd2ddd51' or one of its dependencies. The system cannot find the file specifie
d.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13
ffcd2ddd51'
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadEdito
rServices()
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.<LoadAndR
unEditorServicesAsync>d__9.MoveNext()

dProcessing()
---> (Inner Exception #0) System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadEditorServices()
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.<LoadAndRunEditorServicesAsync>d__9.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
<---

== Press any key to close terminal ==

It's a test Domain Controller and I wanted to test something out. First time install, straight install of Preview Extension, and only that extension.

Attached Logs

Follow the instructions in the README about capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.14393
VSCode 1.41.1
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.14393.3383
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.14393.3383
BuildVersion 10.0.14393.3383
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand) |Extension|Author|Version| |---|---|---| |powershell-preview|ms-vscode|2019.12.0|
TylerLeonhardt commented 4 years ago

Interesting... The last update to the extension should have redistributed that assembly netstandard...

Can you give me a full dump of what's in this directory?

gci -rec ~/.vscode/extensions/ms-vscode.powershell-preview-2019.11.0/modules/PowerShellEditorServices/bin/

if you use vscode insiders the path will be .vscode-insiders instead of .vscode

PrzemyslawKlys commented 4 years ago

Here you go

PS C:\Users\Administrator\Desktop> gci -rec ~/.vscode/extensions/ms-vscode.powershell-preview-2019.12.0/modules/PowerShellEditorServices/bin/

    Directory: C:\Users\Administrator\.vscode\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\bin

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       12/27/2019  12:56 PM                Common
d-----       12/27/2019  12:56 PM                Core
d-----       12/27/2019  12:56 PM                Desktop

    Directory: C:\Users\Administrator\.vscode\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\bin\Common

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       12/27/2019  12:56 PM           9052 libdisablekeyecho.dylib
-a----       12/27/2019  12:56 PM           8840 libdisablekeyecho.so
-a----       12/27/2019  12:56 PM          17920 MediatR.dll
-a----       12/27/2019  12:56 PM          15360 MediatR.Extensions.Microsoft.DependencyInjection.dll
-a----       12/27/2019  12:56 PM          21064 Microsoft.Bcl.AsyncInterfaces.dll
-a----       12/27/2019  12:56 PM         302664 Microsoft.CSharp.dll
-a----       12/27/2019  12:56 PM          21368 Microsoft.Extensions.Configuration.Abstractions.dll
-a----       12/27/2019  12:56 PM          24952 Microsoft.Extensions.Configuration.Binder.dll
-a----       12/27/2019  12:56 PM          27000 Microsoft.Extensions.Configuration.dll
-a----       12/27/2019  12:56 PM          37752 Microsoft.Extensions.DependencyInjection.Abstractions.dll
-a----       12/27/2019  12:56 PM          64888 Microsoft.Extensions.DependencyInjection.dll
-a----       12/27/2019  12:56 PM          39288 Microsoft.Extensions.FileSystemGlobbing.dll
-a----       12/27/2019  12:56 PM          48504 Microsoft.Extensions.Logging.Abstractions.dll
-a----       12/27/2019  12:56 PM          34168 Microsoft.Extensions.Logging.dll
-a----       12/27/2019  12:56 PM          50552 Microsoft.Extensions.Options.dll
-a----       12/27/2019  12:56 PM          38264 Microsoft.Extensions.Primitives.dll
-a----       12/27/2019  12:56 PM          34682 Microsoft.PowerShell.EditorServices.deps.json
-a----       12/27/2019  12:56 PM         562048 Microsoft.PowerShell.EditorServices.dll
-a----       12/27/2019  12:56 PM         147612 Microsoft.PowerShell.EditorServices.pdb
-a----       12/27/2019  12:56 PM         656384 Newtonsoft.Json.dll
-a----       12/27/2019  12:56 PM          89600 OmniSharp.Extensions.DebugAdapter.dll
-a----       12/27/2019  12:56 PM           6656 OmniSharp.Extensions.DebugAdapter.Server.dll
-a----       12/27/2019  12:56 PM          70656 OmniSharp.Extensions.JsonRpc.dll
-a----       12/27/2019  12:56 PM         182272 OmniSharp.Extensions.LanguageProtocol.dll
-a----       12/27/2019  12:56 PM          78336 OmniSharp.Extensions.LanguageServer.dll
-a----       12/27/2019  12:56 PM         126464 Serilog.dll
-a----       12/27/2019  12:56 PM          15872 Serilog.Extensions.Logging.dll
-a----       12/27/2019  12:56 PM           9216 Serilog.Sinks.Async.dll
-a----       12/27/2019  12:56 PM          28160 Serilog.Sinks.File.dll
-a----       12/27/2019  12:56 PM          27992 System.Buffers.dll
-a----       12/27/2019  12:56 PM          81040 System.ComponentModel.Annotations.dll
-a----       12/27/2019  12:56 PM          22432 System.IO.FileSystem.Primitives.dll
-a----       12/27/2019  12:56 PM          27280 System.IO.Pipes.AccessControl.dll
-a----       12/27/2019  12:56 PM         148720 System.Memory.dll
-a----       12/27/2019  12:56 PM         163712 System.Numerics.Vectors.dll
-a----       12/27/2019  12:56 PM        1246648 System.Reactive.dll
-a----       12/27/2019  12:56 PM          16968 System.Runtime.CompilerServices.Unsafe.dll
-a----       12/27/2019  12:56 PM          22840 System.Runtime.InteropServices.WindowsRuntime.dll
-a----       12/27/2019  12:56 PM          54416 System.Security.AccessControl.dll
-a----       12/27/2019  12:56 PM          21736 System.Security.Principal.dll
-a----       12/27/2019  12:56 PM          33656 System.Security.Principal.Windows.dll
-a----       12/27/2019  12:56 PM          33008 System.Threading.Tasks.Extensions.dll
-a----       12/27/2019  12:56 PM           4096 UnixConsoleEcho.dll

    Directory: C:\Users\Administrator\.vscode\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\bin\Core

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       12/27/2019  12:56 PM          37157 Microsoft.PowerShell.EditorServices.Hosting.deps.json
-a----       12/27/2019  12:56 PM          59256 Microsoft.PowerShell.EditorServices.Hosting.dll
-a----       12/27/2019  12:56 PM          11280 Microsoft.PowerShell.EditorServices.Hosting.pdb

    Directory: C:\Users\Administrator\.vscode\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\bin\Desktop

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       12/27/2019  12:56 PM          59776 Microsoft.PowerShell.EditorServices.Hosting.dll
-a----       12/27/2019  12:56 PM          11212 Microsoft.PowerShell.EditorServices.Hosting.pdb
-a----       12/27/2019  12:56 PM          14416 Microsoft.Win32.Primitives.dll
-a----       12/27/2019  12:56 PM          98616 netstandard.dll
-a----       12/27/2019  12:56 PM          14408 System.AppContext.dll
-a----       12/27/2019  12:56 PM          14200 System.Collections.Concurrent.dll
-a----       12/27/2019  12:56 PM          14712 System.Collections.dll
-a----       12/27/2019  12:56 PM          14200 System.Collections.NonGeneric.dll
-a----       12/27/2019  12:56 PM          14200 System.Collections.Specialized.dll
-a----       12/27/2019  12:56 PM          14416 System.ComponentModel.dll
-a----       12/27/2019  12:56 PM          14712 System.ComponentModel.EventBasedAsync.dll
-a----       12/27/2019  12:56 PM          14712 System.ComponentModel.Primitives.dll
-a----       12/27/2019  12:56 PM          15736 System.ComponentModel.TypeConverter.dll
-a----       12/27/2019  12:56 PM          14200 System.Console.dll
-a----       12/27/2019  12:56 PM         147320 System.Data.Common.dll
-a----       12/27/2019  12:56 PM          14712 System.Diagnostics.Contracts.dll
-a----       12/27/2019  12:56 PM          14200 System.Diagnostics.Debug.dll
-a----       12/27/2019  12:56 PM          14200 System.Diagnostics.FileVersionInfo.dll
-a----       12/27/2019  12:56 PM          14712 System.Diagnostics.Process.dll
-a----       12/27/2019  12:56 PM          16760 System.Diagnostics.StackTrace.dll
-a----       12/27/2019  12:56 PM          14200 System.Diagnostics.TextWriterTraceListener.dll
-a----       12/27/2019  12:56 PM          14200 System.Diagnostics.Tools.dll
-a----       12/27/2019  12:56 PM          14928 System.Diagnostics.TraceSource.dll
-a----       12/27/2019  12:56 PM          24440 System.Diagnostics.Tracing.dll
-a----       12/27/2019  12:56 PM          14200 System.Drawing.Primitives.dll
-a----       12/27/2019  12:56 PM          15440 System.Dynamic.Runtime.dll
-a----       12/27/2019  12:56 PM          14712 System.Globalization.Calendars.dll
-a----       12/27/2019  12:56 PM          14200 System.Globalization.dll
-a----       12/27/2019  12:56 PM          18808 System.Globalization.Extensions.dll
-a----       12/27/2019  12:56 PM         103800 System.IO.Compression.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.Compression.ZipFile.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.dll
-a----       12/27/2019  12:56 PM          14416 System.IO.FileSystem.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.FileSystem.DriveInfo.dll
-a----       12/27/2019  12:56 PM          14416 System.IO.FileSystem.Watcher.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.IsolatedStorage.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.MemoryMappedFiles.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.Pipes.dll
-a----       12/27/2019  12:56 PM          14200 System.IO.UnmanagedMemoryStream.dll
-a----       12/27/2019  12:56 PM          14200 System.Linq.dll
-a----       12/27/2019  12:56 PM          15224 System.Linq.Expressions.dll
-a----       12/27/2019  12:56 PM          14200 System.Linq.Parallel.dll
-a----       12/27/2019  12:56 PM          14200 System.Linq.Queryable.dll
-a----       12/27/2019  12:56 PM         191352 System.Net.Http.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.NameResolution.dll
-a----       12/27/2019  12:56 PM          15224 System.Net.NetworkInformation.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.Ping.dll
-a----       12/27/2019  12:56 PM          15224 System.Net.Primitives.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.Requests.dll
-a----       12/27/2019  12:56 PM          14712 System.Net.Security.dll
-a----       12/27/2019  12:56 PM          23416 System.Net.Sockets.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.WebHeaderCollection.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.WebSockets.Client.dll
-a----       12/27/2019  12:56 PM          14200 System.Net.WebSockets.dll
-a----       12/27/2019  12:56 PM          14712 System.ObjectModel.dll
-a----       12/27/2019  12:56 PM          15224 System.Reflection.dll
-a----       12/27/2019  12:56 PM          14200 System.Reflection.Extensions.dll
-a----       12/27/2019  12:56 PM          14712 System.Reflection.Primitives.dll
-a----       12/27/2019  12:56 PM          14200 System.Resources.Reader.dll
-a----       12/27/2019  12:56 PM          14200 System.Resources.ResourceManager.dll
-a----       12/27/2019  12:56 PM          14200 System.Resources.Writer.dll
-a----       12/27/2019  12:56 PM          14712 System.Runtime.CompilerServices.VisualC.dll
-a----       12/27/2019  12:56 PM          22392 System.Runtime.dll
-a----       12/27/2019  12:56 PM          14712 System.Runtime.Extensions.dll
-a----       12/27/2019  12:56 PM          14200 System.Runtime.Handles.dll
-a----       12/27/2019  12:56 PM          17272 System.Runtime.InteropServices.dll
-a----       12/27/2019  12:56 PM          21368 System.Runtime.InteropServices.RuntimeInformation.dll
-a----       12/27/2019  12:56 PM          14200 System.Runtime.Numerics.dll
-a----       12/27/2019  12:56 PM          14200 System.Runtime.Serialization.Formatters.dll
-a----       12/27/2019  12:56 PM          14200 System.Runtime.Serialization.Json.dll
-a----       12/27/2019  12:56 PM          19832 System.Runtime.Serialization.Primitives.dll
-a----       12/27/2019  12:56 PM          17784 System.Runtime.Serialization.Xml.dll
-a----       12/27/2019  12:56 PM          14200 System.Security.Claims.dll
-a----       12/27/2019  12:56 PM          39800 System.Security.Cryptography.Algorithms.dll
-a----       12/27/2019  12:56 PM          14200 System.Security.Cryptography.Csp.dll
-a----       12/27/2019  12:56 PM          14200 System.Security.Cryptography.Encoding.dll
-a----       12/27/2019  12:56 PM          14920 System.Security.Cryptography.Primitives.dll
-a----       12/27/2019  12:56 PM          15736 System.Security.Cryptography.X509Certificates.dll
-a----       12/27/2019  12:56 PM          15224 System.Security.SecureString.dll
-a----       12/27/2019  12:56 PM          14712 System.Text.Encoding.dll
-a----       12/27/2019  12:56 PM          14200 System.Text.Encoding.Extensions.dll
-a----       12/27/2019  12:56 PM          14200 System.Text.RegularExpressions.dll
-a----       12/27/2019  12:56 PM          15224 System.Threading.dll
-a----       12/27/2019  12:56 PM          30584 System.Threading.Overlapped.dll
-a----       12/27/2019  12:56 PM          15432 System.Threading.Tasks.dll
-a----       12/27/2019  12:56 PM          14200 System.Threading.Tasks.Parallel.dll
-a----       12/27/2019  12:56 PM          14416 System.Threading.Thread.dll
-a----       12/27/2019  12:56 PM          14200 System.Threading.ThreadPool.dll
-a----       12/27/2019  12:56 PM          14200 System.Threading.Timer.dll
-a----       12/27/2019  12:56 PM          78992 System.ValueTuple.dll
-a----       12/27/2019  12:56 PM          14712 System.Xml.ReaderWriter.dll
-a----       12/27/2019  12:56 PM          14712 System.Xml.XDocument.dll
-a----       12/27/2019  12:56 PM          14712 System.Xml.XmlDocument.dll
-a----       12/27/2019  12:56 PM          14712 System.Xml.XmlSerializer.dll
-a----       12/27/2019  12:56 PM          14416 System.Xml.XPath.dll
-a----       12/27/2019  12:56 PM          15952 System.Xml.XPath.XDocument.dll
TylerLeonhardt commented 4 years ago

Interesting. It's definitely in there...

Naturally the workaround for this is:

But @rjmholt explicitly wanted to fix this scenario with the last Preview so maybe something was missed there

PrzemyslawKlys commented 4 years ago

I'm okay with workarounds (at least 2nd one) - it would be nice to have a graceful message, rather than a crash.

rjmholt commented 4 years ago

I'm going to look into this, since it's unexpected. We might also be able to catch certain assembly load exceptions if they're thrown in the right way, but I can't guarantee anything until I've had a look.

DarkLite1 commented 4 years ago

Experienced the very same issue today on a fresh install, Windows Server 2016. I'll now try the workaround of installing .NET Framework 4.7.2 or higher.

image

Version: 1.42.0-insider (system setup)
Commit: cba31b819ea99836daf51cee56299348e9c6d20b
Date: 2020-01-08T05:39:25.874Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.14393
rjmholt commented 4 years ago

I've have a fix for this, linked above and have tested it on Windows Server 2016 with .NET 4.6.2 and .NET 4.7.0. So this should be fixed in the next release.