vscode-powershell: Binary Module Debugging with Script specified causes a terminal error exit -1 at the end of the debugging session on Windows only

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

I’m getting a crash when I attempt to debug the binary module using a new configuration. The module is the not altered example binary module.

        {
            "name": "PowerShell: Binary Module Interactive",
            "type": "PowerShell",
            "request": "launch",
            "script": "Import-Module -Force ${workspaceFolder}/DebugPSModule/bin/Debug/net8.0/DebugPSModule.dll",
            "createTemporaryIntegratedConsole": true,
            "attachDotnetDebugger": true
          }

Launching test script works: Test-SampleCmdlet -FavoriteNumber 8 -FavoritePet Dog

VERBOSE: Begin!

VERBOSE: End!
FavoriteNumber FavoritePet
-------------- -----------
             8 Dog

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.4
PSEdition                      Core
GitCommitId                    7.4.0-preview.4
OS                             Microsoft Windows 10.0.23521
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

Version: 1.81.1
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:22:42.175Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.23521

Extension Version

PowerShell Extension v2023.6.0
C# Dev Kit v0.3.21
NET Install Tool for Extension Authors v1.7.0
Inline Values support for PowerShell v0.0.7

Steps to Reproduce

  • Hit F5

Visuals

No response

Logs

logs.zip sessions.zip

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

The problem is that the attach being stopped actually kills the process rather than disconnecting, but there doesn’t appear to be an extension api to initiate a disconnect, so this is blocked on: https://github.com/microsoft/vscode-discussions/discussions/767