Skip to content

Improve remote deploy/debug workflow: SSH certs, sudo-elevated debugger, dotnet publish, Stop button, modernized Options UI - #106

Open
Kinchul wants to merge 8 commits into
SuessLabs:developfrom
fiveco:upstream-pr
Open

Improve remote deploy/debug workflow: SSH certs, sudo-elevated debugger, dotnet publish, Stop button, modernized Options UI#106
Kinchul wants to merge 8 commits into
SuessLabs:developfrom
fiveco:upstream-pr

Conversation

@Kinchul

@Kinchul Kinchul commented Sep 9, 2026

Copy link
Copy Markdown

Hey, your extension is great but had a few bugs. Since it was simpler fixing them with Claude rather than finding workarounds in visual studio to make my setup work, I took the time to update it.

I don't know if you still maintain it, feel free to merge it or not. It's basically a considerable refactoring of the option pane with fixes and new features and upgrade of Avalonia test projects (not used, not tested). Also, I use it for non-GUI project so all the GUI part is not tested.

Description of Change

This adds a handful of features I needed while debugging a self-contained ARM64 .NET service running under systemd on an embedded Linux device, plus a redesign of the Options UI that was overdue.

What's new

  • SSH CA certificate auth — connect using a private key plus an OpenSSH certificate (-cert.pub), auto-detected next to the key or set explicitly. Needed for devices whose sshd trusts a CA instead of per-key authorized_keys.
  • Sudo-elevated debugger launch — an opt-in setting launches vsdbg via a configurable sudo command, for debuggees with ambient/elevated capabilities that vsdbg needs to match to attach.
  • Always deploy via dotnet publish — instead of uploading a plain build's output folder, deploy now always runs dotnet publish -r --self-contained <true|false>. This produces a real, launchable native executable either way (a plain build doesn't reliably produce one), and sidesteps the SDK's RID-specific output subfolder.
  • Environment variables for the debuggee, and configurable pre/post-deploy shell commands (e.g. stopping/starting a systemd service around the upload).
  • Attach to an already-running process — via a configurable PID-lookup command, instead of vsdbg always launching a new instance that wouldn't inherit a supervisor's environment/capabilities.
  • Attach Only menu item, and a Stop button to cancel an in-progress build/deploy/debug between steps.
  • Fixed a real bug: BuildOptions was missing [Flags] and used sequential values, so Debug (3) already contained the Deploy (1) bit — "Attach Only" was silently triggering a full build+deploy.

Options UI

Replaced the single PropertyGrid-based options page with five focused WPF pages (Remote Host, Remote Credentials, Remote Debugger, Remote Launch, Local), real checkboxes, and dynamic show/hide for fields that only apply when a related checkbox is checked. Screenshots updated.

Also

  • SSH.NET bumped to 2026.0.0 (adds OpenSSH certificate support, fixes a high-severity ScpClient vulnerability).
  • VsixVersion centralized to one MSBuild property instead of three places to edit.

Everything above was tested against a real Raspberry Pi-class device over SSH (password, key, and CA-cert auth).

Logger.Output/Debug write via IVsOutputWindowPane.OutputStringThreadSafe,
which is documented safe to call off the UI thread. The analyzer cannot
express 'this specific call is verified safe' and instead taints every
method in the call graph (all of SshTool/RemoteDebugger/LaunchBuilder's
async SSH/deploy code) as UI-thread-only. Tried marshalling pane
creation/Activate() through JoinableTaskFactory explicitly; the warning
still propagated syntactically to every caller regardless of correct
runtime behavior, so a scoped suppression is the accurate fix rather
than churning ~15 call sites for no behavioral gain.
Adds support for connecting with a private key plus an accompanying
OpenSSH certificate (a '<key>-cert.pub' file, auto-detected next to
the key by convention or set explicitly via 'SSH Certificate File'),
in addition to plain password and private-key auth. Needed for
devices whose sshd trusts a CA (TrustedUserCAKeys) instead of
per-key authorized_keys entries.

SshTool.ConnectAsync now looks up and passes a certificate alongside
the private key when connecting, both for the SFTP/SCP upload
connection and, via SshConnectionInfo, the debugger's own SSH
connection.
…eploy lifecycle

Several related changes to how the debuggee is deployed, started,
and attached to:

- Sudo-elevated debugger launch: an opt-in setting launches vsdbg via
  a configurable sudo command, for debuggees running with elevated
  or ambient capabilities the debugger must match in order to attach
  (ptrace requires the tracer's capabilities to be a superset of the
  tracee's).
- Environment variables for the debuggee: 'KEY=VALUE' pairs passed
  through to the remote process, for programs that read required
  configuration from the environment.
- Deploy always goes through 'dotnet publish -r <rid> --self-contained
  <true|false>' now, producing a real native executable either way
  (a plain build's output folder does not reliably produce a usable
  one), with the executable bit restored after transfer (lost by
  default over tar/scp from Windows).
- Configurable pre/post-deploy shell commands (run around each
  upload) and an 'attach to already-running process' mode (with a
  configurable PID-lookup command), for debuggees managed by an
  external supervisor such as a systemd service -- attaching to that
  exact process instead of launching a second, unmanaged instance
  that wouldn't inherit the supervisor's environment/capabilities.
- Fixed BuildOptions missing [Flags] and using sequential
  (non-power-of-two) values, which caused bit-flag collisions:
  Debug (previously 3) already contained the Deploy (1) bit, so
  'Attach Only' silently behaved like a full build+deploy+debug.
- Added a Stop command, cancellable via a CancellationToken threaded
  through the whole build/deploy/debug flow, checked between major
  steps (an in-flight SSH command is instead let to finish, unless
  ForceKillOnStop is enabled).
…nly menu items

Replaces the single OptionsPage (a WinForms PropertyGrid over three
partial classes) with five focused Tools > Options pages -- Remote
Host, Remote Credentials, Remote Debugger, Remote Launch, Local --
each a real WPF UIElementDialogPage with checkboxes, dynamic
show/hide for fields that only matter when a governing checkbox is
checked (private key vs. password, sudo command, PID command, X11
display number, PLink path), and a shared 'Edit...' modal for the
three multi-line fields (Environment Variables, Pre/Post-Deploy
Commands) since Enter can't be made to insert a newline in a
TextBox hosted by UIElementDialogPage's native dialog (IsDialogMessage
intercepts it before WPF ever sees the keystroke, routing it to the
dialog's default button instead).

Menu (.vsct) changes:
- 'Attach Only (no build/deploy)' to reattach to a running/deployed
  process without rebuilding or redeploying.
- 'Stop' to cancel an in-progress build/deploy/debug, enabled only
  while an operation is running (DefaultDisabled + explicit
  Enabled=false at creation, since OleMenuCommand.Enabled otherwise
  defaults to true until the menu is first queried).
- Version now driven by a single $(VsixVersion) MSBuild property
  in VsLinuxDebugger.csproj, exposed to the manifest via
  |%CurrentProject%;GetVsixVersion| and to AssemblyInfo via a
  generated AssemblyVersionInfo.cs -- one place to bump instead of
  three.
- SSH.NET 2023.0.1 -> 2026.0.0 (adds OpenSSH certificate support,
  fixes a high-severity ScpClient arbitrary-file-write vulnerability
  fixed upstream in that release); ScpClient construction updated to
  the RemotePathTransformation-taking overloads the old ones were
  obsoleted in favor of.
- Added PresentationCore/PresentationFramework/System.Xaml/
  WindowsBase references and Page items for the new WPF Options
  pages.
- Reset VsixVersion to 3.0.0 for this contribution.
Documents the new features (SSH cert auth, sudo-elevated debugger,
dotnet publish deploy, env vars, pre/post-deploy commands and
attach-to-running-process, Attach Only, Stop button, modernized
Options UI), fixes button-name inconsistencies against the actual
.vsct text, and updates the menu/Options screenshots to match the
current UI instead of the pre-existing single-page PropertyGrid.
@Kinchul Kinchul changed the title Upstream pr Improve remote deploy/debug workflow: SSH certs, sudo-elevated debugger, dotnet publish, Stop button, modernized Options UI Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant