weixin_39921224
weixin_39921224
2020-12-05 18:04

Cannot start powershell 6 in debug on vscode

Trying to run pwsh.exe as a debug environment does not work in vscode. The terminal starts, but appears to disconnect from the environment immediately. Looking at the logs, I see:

console
1/18/2019 11:10:56 AM [NORMAL] - Language server starting --
1/18/2019 11:10:56 AM [NORMAL] -     exe: C:\Program Files\PowerShell\6\pwsh.exe
1/18/2019 11:10:56 AM [NORMAL] -     args: C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules' -EnableConsoleRepl -LogLevel 'Normal' -DebugServiceOnly -LogPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\logs\1547804527-4208a79f-0b41-47bb-a104-75bf366ab1ec1547804506522\DebugSession-1.log' -SessionDetailsPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\sessions\PSES-VSCode-14592-Debug' -FeatureFlags @()
1/18/2019 11:10:57 AM [NORMAL] - powershell.exe started, pid: 28196
1/18/2019 11:11:00 AM [NORMAL] - powershell.exe terminated or terminal UI was closed

Attempting to run the command manually, I get the following output:

console
PS C:\WINDOWS\system32> & 'C:\Program Files\PowerShell\6\pwsh.exe' C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules' -EnableConsoleRepl -LogLevel 'Normal' -DebugServiceOnly -LogPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\logs\1547804527-4208a79f-0b41-47bb-a104-75bf366ab1ec1547804506522\DebugSession-1.log' -SessionDetailsPath 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\sessions\PSES-VSCode-14592-Debug' -FeatureFlags @()
C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\Start-EditorServices.ps1 : Missing an argument for parameter 'FeatureFlags'. Specify a parameter of type 'System.String[]' and try again.
+ CategoryInfo          : InvalidArgument: (:) [Start-EditorServices.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArgument,Start-EditorServices.ps1

PS C:\WINDOWS\system32>

This also fails if I use powershell.exe as the source, that also wants a string rather than an array.

Once I remove the -FeatureFlags @() section of the command, I get a comman line with PowerShell Integrated Terminal that apparently does nothing (I suspect because it's told to receive and pipe its output externally).

Versions:

VSCode version: 1.30.2 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8 x64

VSCode extensions:

AureliaEffect.aurelia.0.3 ban.spellright.0.22 codezombiech.gitignore.6.0 DavidAnson.vscode-markdownlint.23.0 DotJoshJohnson.xml.4.0 eamodio.gitlens.4.1 eg2.tslint.0.42 eg2.vscode-npm-script.3.5 fernandoescolar.vscode-solution-explorer.3.1 formulahendry.dotnet-test-explorer.6.0 GitHub.vscode-pull-request-github.3.2 heaths.vscode-guid.4.0 HookyQR.beautify.4.7 jesschadwick.nuget-reverse-package-search.1.68 jmrog.vscode-nuget-package-manager.1.6 k--kato.docomment.1.2 mauve.terraform.3.7 ms-azure-devops.azure-pipelines.147.1 ms-kubernetes-tools.vscode-kubernetes-tools.1.15 ms-vscode.azurecli.4.2 ms-vscode.csharp.17.1 ms-vscode.PowerShell.10.2 ms-vsliveshare.vsliveshare.3.1121 ms-vsliveshare.vsliveshare-audio.1.48 ms-vsts.team.144.1 octref.vetur.14.5 oderwat.indent-rainbow.2.4 PeterJausovec.vscode-docker.5.1 redhat.vscode-yaml.2.1 technosophos.vscode-helm.4.0

PSES version: 1.10.2.0

PowerShell version:

Name Value ---- ----- PSVersion 6.1.0 PSEdition Core GitCommitId 6.1.0 OS Microsoft Windows 10.0.17763 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Modified settings (User):

json
{
    "breadcrumbs.enabled": true,
    "csharp.suppressHiddenDiagnostics": false,
    "docker.attachShellCommand.linuxContainer": "/bin/bash",
    "editor.fontFamily": "fira code retina medium",
    "editor.fontLigatures": true,
    "editor.renderControlCharacters": true,
    "editor.renderWhitespace": "all",
    "git.autofetch": true,
    "git.confirmSync": false,
    "git.enableSmartCommit": true,
    "git.fetchOnPull": true,
    "gitlens.heatmap.toggleMode": "window",
    "powershell.debugging.createTemporaryIntegratedConsole": true,
    "powershell.powerShellExePath": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
    "team.showWelcomeMessage": false,
    "terminal.integrated.shell.windows": "c:\\Program Files\\PowerShell\\6\\pwsh.exe",
    "vs-kubernetes": {
        "vs-kubernetes.minikube-path": "N:\\.vs-kubernetes\\tools\\minikube\\windows-amd64\\minikube.exe"
    },
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Aurelia Dark+",
    "workbench.colorCustomizations": {
        "activityBarBadge.background": "#C6FF00",
        "list.activeSelectionForeground": "#C6FF00",
        "list.inactiveSelectionForeground": "#C6FF00",
        "list.highlightForeground": "#C6FF00",
        "scrollbarSlider.activeBackground": "#C6FF0050",
        "editorSuggestWidget.highlightForeground": "#C6FF00",
        "textLink.foreground": "#C6FF00",
        "progressBar.background": "#C6FF00",
        "pickerGroup.foreground": "#C6FF00",
        "tab.activeBorder": "#C6FF00",
        "notificationLink.foreground": "#C6FF00",
        "editorWidget.resizeBorder": "#C6FF00",
        "editorWidget.border": "#C6FF00",
        "settings.modifiedItemIndicator": "#C6FF00",
        "settings.headerForeground": "#C6FF00",
        "panelTitle.activeBorder": "#C6FF00",
        "breadcrumb.activeSelectionForeground": "#C6FF00",
        "menu.selectionForeground": "#C6FF00",
        "menubar.selectionForeground": "#C6FF00"
    }
}

Modified Settings (Folder):

json
{
    "powershell.codeFormatting.preset": "OTBS"
}

该提问来源于开源项目:PowerShell/vscode-powershell

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39921224 weixin_39921224 5月前

    I just realised I'd already raised a bug-report in this repo for a previous issue (#1658 ) which may or may not be related... it's a completely different failure, but if there's an underlying problem it may be related.

    点赞 评论 复制链接分享
  • weixin_39921224 weixin_39921224 5月前

    I have identified the issue - this is a problem with VS Code Live Share - when I disable that extension, the problem goes away.

    Not sure where to raise this - on that repo or here?

    点赞 评论 复制链接分享
  • weixin_39889792 weixin_39889792 5月前

    is this what you're seeing:

    https://github.com/MicrosoftDocs/live-share/issues/1216

    点赞 评论 复制链接分享
  • weixin_39921224 weixin_39921224 5月前

    It is indeed - already reported, thanks for the heads up. I missed that when searching, sorry for the inconvenience.

    For those reading elsewhere, this is fixed in Microsoft/vscode#61649 which will has a patch already in progress.

    点赞 评论 复制链接分享

相关推荐