Skip to content

PowerShell Extension v2020.3.0 breaks with AppLocker  #1221

Closed
@johlju

Description

@johlju

We are allowing scripts and executables in the extension folder to be run in %OSDRIVE%\USERS\%USER%\.VSCODE\EXTENSIONS. The below error happens with the new version, but this does work with the previous version. As a workaround we have reverted back to the previous version for now.

Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 247 in EndProcessing:
System.Management.Automation.CmdletInvocationException: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator. ---> System.NotSupportedException: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.
   --- Slut på stackspårning för interna undantag ---
   vid System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   vid System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   vid System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   vid System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   vid System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   vid Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LogPowerShellDetails()
   vid Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LogHostInformation()
   vid Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadAndRunEditorServicesAsync()
   vid Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()
2020-03-06 10:31:05 [NORMAL] - Visual Studio Code v1.42.1 64-bit
2020-03-06 10:31:05 [NORMAL] - PowerShell Extension v2020.3.0
2020-03-06 10:31:05 [NORMAL] - Operating System: Windows 64-bit
2020-03-06 10:31:05 [NORMAL] - Language server starting --
2020-03-06 10:31:05 [NORMAL] -     PowerShell executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
2020-03-06 10:31:05 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.3.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\logs\1583487065-bd4cd06b-756f-42c5-b413-6b485a2b237b1583487062238\EditorServices.log' -SessionDetailsPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\sessions\PSES-VSCode-13336-569282' -FeatureFlags @() 
2020-03-06 10:31:05 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.3.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\logs\1583487065-bd4cd06b-756f-42c5-b413-6b485a2b237b1583487062238\EditorServices.log' -SessionDetailsPath 'c:\Users\johlju\.vscode\extensions\ms-vscode.powershell-2020.3.0\sessions\PSES-VSCode-13336-569282' -FeatureFlags @() 
2020-03-06 10:31:05 [NORMAL] - powershell.exe started.
2020-03-06 10:31:05 [NORMAL] - Waiting for session file
2020-03-06 10:33:05 [NORMAL] - Error occurred retrieving session file
2020-03-06 10:33:05 [NORMAL] - Language server startup failed.
2020-03-06 10:33:05 [ERROR] - The language service could not be started: 
2020-03-06 10:33:05 [ERROR] - Timed out waiting for session file to appear.

If you need more debug information let us know.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions