vscode-powershell: 'Unable to load DLL' exception on extension start
Issue Type: Bug
After installing PowerShell extension and opening a blank *.ps1 file, I immediately see the following exception in the Terminal window (PowerShell Integrated Console):
Unable to load DLL 'api-ms-win-core-sysinfo-l1-2-0.dll': The specified module could not be found.
Here’s the (verbose) logs:
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: C:\Users\<username>\Documents\WindowsPowerShell\Modules
VERBOSE: C:\Program Files\WindowsPowerShell\Modules
VERBOSE: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
VERBOSE: C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\modules
VERBOSE:
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: PowerShellGet found
VERBOSE:
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path 'C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
PowerShell Integrated Console
VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: ERRORS caught starting up EditorServicesHost
VERBOSE: Exception calling "StartLogging" with "2" argument(s): "Unable to load DLL 'api-ms-win-core-sysinfo-l1-2-0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
Unable to load DLL 'api-ms-win-core-sysinfo-l1-2-0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Interop.mincore.GetNativeSystemInfo(SYSTEM_INFO& lpSystemInfo)
at System.Runtime.InteropServices.RuntimeInformation.get_OSArchitecture()
at Microsoft.PowerShell.EditorServices.Host.EditorServicesHost.StartLogging(String logFilePath, LogLevel logLevel)
at CallSite.Target(Closure , CallSite , Object , Object , Object )
Following this, a popup informs me “The language service could not be started”, with the output showing:
12/6/2018 8:04:32 AM [NORMAL] - Visual Studio Code v1.29.1 64-bit
12/6/2018 8:04:32 AM [NORMAL] - PowerShell Extension v1.10.0
12/6/2018 8:04:32 AM [NORMAL] - Operating System: Windows 64-bit
12/6/2018 8:04:32 AM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
12/6/2018 8:04:32 AM [NORMAL] - Language server starting --
12/6/2018 8:04:32 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
12/6/2018 8:04:32 AM [NORMAL] - args: C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.10.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\logs\1544079872-16daafe7-886f-4c9b-a9b0-0f679d62a7f51544079869517\EditorServices.log' -SessionDetailsPath 'C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-1.10.0\sessions\PSES-VSCode-6216-312941' -FeatureFlags @()
12/6/2018 8:04:33 AM [NORMAL] - powershell.exe started, pid: 15068
12/6/2018 8:06:32 AM [NORMAL] - Language server startup failed.
12/6/2018 8:06:32 AM [ERROR] - The language service could not be started:
12/6/2018 8:06:32 AM [ERROR] - Timed out waiting for session file to appear.
12/6/2018 8:09:33 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
General Info
| Name | Value |
|---|---|
| Extension version | 1.10.0 |
| VS Code version | Code 1.29.1 (bc24f98b5f70467bc689abf41cc5550ca637088e, 2018-11-15T19:13:36.375Z) |
| OS version | Windows_NT x64 6.1.7601 (Windows 7) |
$PSVersionTable
| Name | Value |
|---|---|
| PSVersion | 5.1.14409.1012 |
| PSEdition | Desktop |
| PSCompatibleVersions | {1.0, 2.0, 3.0, 4.0…} |
| BuildVersion | 10.0.14409.1012 |
| CLRVersion | 4.0.30319.42000 |
| WSManStackVersion | 3.0 |
| PSRemotingProtocolVersion | 2.3 |
| SerializationVersion | 1.1.0.1 |
VS Code Info
| Item | Value |
|---|---|
| Version | 1.29.1 (user setup) |
| Commit | bc24f98b5f70467bc689abf41cc5550ca637088e |
| Date | 2018-11-15T19:13:36.375Z |
| Electron | 2.0.12 |
| Chrome | 61.0.3163.100 |
| Node.js | 8.9.3 |
| V8 | 6.1.534.41 |
| Architecture | x64 |
System Info
| Item | Value |
|---|---|
| CPUs | Intel® Core™ i7-6820HQ CPU @ 2.70GHz (8 x 2712) |
| GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled |
| Memory (System) | 15.88GB (3.36GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 75% |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 19 (1 by maintainers)
I just updated to v1.10.1 and everything’s working well. Thanks for the quick response!
Here’s the required file for now, taken from the nuget package. You can unzip it and put it into
~/.vscode/extensions/ms-vscode.powershell-1.10.0/modules/PowerShellEditorServices/bin/Desktop:sysinfo_dll.zip
(GitHub doesn’t allow non-zip attachments)
@gtaylor1981 Thanks for all the info you provided too. That stack trace was invaluable.
I’m new to PowerShell, so I just installed the extension for the first time.
I can’t think of much more that would help… Perhaps that I just clicked the ‘install suggested extension’ button without adding any extra config files etc. It’s also a work computer, so may have had certain security policies and/or various PS upgrades applied over time. Searching for
api-ms-win-core-sysinfo-l1-2-0.dllturns up a few other people with a similar error, although not in VS Code. I have various versions of this DLL on my system, including inC:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\api-ms-win-core-sysinfo-l1-1-0.dllandC:\Windows\System32\api-ms-win-core-sysinfo-l1-1-0.dllBoth of which are v1.1, not the requested v1.2Do let me know if I can be of further assistance.