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
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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
Everything above was tested against a real Raspberry Pi-class device over SSH (password, key, and CA-cert auth).