Skip to content

Merge 'main' into 'release-cpptools' - #1622

Open
Andrew Wang (WardenGnaw) wants to merge 26 commits into
release-cpptoolsfrom
main
Open

Merge 'main' into 'release-cpptools'#1622
Andrew Wang (WardenGnaw) wants to merge 26 commits into
release-cpptoolsfrom
main

Conversation

@WardenGnaw

Copy link
Copy Markdown
Member

No description provided.

This PR:
- Adds copilot-instructions.md with links to documentation
- Adds a READMD.md to the various DebugEngineHost implementations to make that more clear
- Fixes a bug with how `DependsOnTest` works which made it so that any test with that attribute couldn't be run with a test filter
Disable NullPointerNotExpandable test for cppvsdbg
…rn (#1579)

* Refactor Docker transport into shared base classes and strategy pattern

Extract shared container transport infrastructure to enable additional
container runtimes without duplicating Docker code.

Key changes:
- `ContainerTransportSettingsBase` shared abstract base eliminates
  duplication in transport settings (exe name, host flag, command format)
- `IContainerDiscoveryStrategy` interface with Docker implementation
  keeps runtime-specific logic out of the ViewModel
- `ContainerRuntimeType` enum threaded through port picker ->
  ConnectionManager -> dialog for future extensibility
- XAML bindings changed from static resources to ViewModel properties
  so labels can vary per runtime

No behavioral changes - Docker works exactly as before.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback: remove unused field, add type check

- Remove unused _runtimeType field from ContainerPickerViewModel
- Add explicit type check in DockerExecutionManager.CreateExecSettings
  instead of unsafe cast

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: seal classes, use OrdinalIgnoreCase, remove defaults

- Seal DockerDiscoveryStrategy, DockerCommandSettings,
  DockerContainerTransportSettings, DockerExecSettings, DockerCopySettings
- Use StringComparison.OrdinalIgnoreCase for Windows check in
  AssignPlatforms instead of ToTitleCase + Contains
- Remove default parameter values for ContainerRuntimeType to force
  explicit runtime selection by callers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Hoist CultureInfo allocation outside loop

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add Podman container support for Attach to Process

Adds Podman as a container runtime option in the Attach to Process dialog,
enabling developers to discover and debug processes inside Podman containers.

- New PodmanConnection, PodmanContainerInstance, PodmanDiscoveryStrategy,
  PodmanExecutionManager, PodmanHelper, PodmanPortPicker, PodmanPortSupplier,
  and PodmanTransportSettings classes
- Renamed DockerContainerInstance to ContainerInstance (shared by both runtimes)
- Renamed DockerHostPrefixRegex/DockerHostPrefix to HostPrefixRegex/HostPrefix
- Registered Podman port supplier and CLSID in pkgdef files
- Added ContainerRuntimeType.Podman enum value
- Added Podman case in ContainerPickerViewModel and ConnectionManager

NOTE: The Podman port supplier also needs to be registered in vsdbg's
VsIntegration.pkgdef for full VS integration.

* Address PR comments
* Refactor Docker transport into shared base classes and strategy pattern (#1579)

* Refactor Docker transport into shared base classes and strategy pattern

Extract shared container transport infrastructure to enable additional
container runtimes without duplicating Docker code.

Key changes:
- `ContainerTransportSettingsBase` shared abstract base eliminates
  duplication in transport settings (exe name, host flag, command format)
- `IContainerDiscoveryStrategy` interface with Docker implementation
  keeps runtime-specific logic out of the ViewModel
- `ContainerRuntimeType` enum threaded through port picker ->
  ConnectionManager -> dialog for future extensibility
- XAML bindings changed from static resources to ViewModel properties
  so labels can vary per runtime

No behavioral changes - Docker works exactly as before.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback: remove unused field, add type check

- Remove unused _runtimeType field from ContainerPickerViewModel
- Add explicit type check in DockerExecutionManager.CreateExecSettings
  instead of unsafe cast

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: seal classes, use OrdinalIgnoreCase, remove defaults

- Seal DockerDiscoveryStrategy, DockerCommandSettings,
  DockerContainerTransportSettings, DockerExecSettings, DockerCopySettings
- Use StringComparison.OrdinalIgnoreCase for Windows check in
  AssignPlatforms instead of ToTitleCase + Contains
- Remove default parameter values for ContainerRuntimeType to force
  explicit runtime selection by callers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Hoist CultureInfo allocation outside loop

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add Podman container support for Attach to Process (#1582)

* Add Podman container support for Attach to Process

Adds Podman as a container runtime option in the Attach to Process dialog,
enabling developers to discover and debug processes inside Podman containers.

- New PodmanConnection, PodmanContainerInstance, PodmanDiscoveryStrategy,
  PodmanExecutionManager, PodmanHelper, PodmanPortPicker, PodmanPortSupplier,
  and PodmanTransportSettings classes
- Renamed DockerContainerInstance to ContainerInstance (shared by both runtimes)
- Renamed DockerHostPrefixRegex/DockerHostPrefix to HostPrefixRegex/HostPrefix
- Registered Podman port supplier and CLSID in pkgdef files
- Added ContainerRuntimeType.Podman enum value
- Added Podman case in ContainerPickerViewModel and ConnectionManager

NOTE: The Podman port supplier also needs to be registered in vsdbg's
VsIntegration.pkgdef for full VS integration.

* Address PR comments

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…peline

Fix DebuggerTesting Release Pipeline
This PR contains the work to enable nullable reference types for the first project in MIEngine -- the DebugEngineHost implementations.

**Changes:**
- Turn on `<Nullable>enable</Nullable>` for the DebugEngineHost projects and update APIs/fields to nullable annotations (`?`, `is null`, `is not null`, null-forgiving where needed).
- Add shared compatibility code for NRT on older frameworks (`NullableHelpers`, `NullableAttributes`) and flow annotations (e.g., `[MaybeNullWhen(false)]`).
- Set repo-wide C# language version to 12.0 and simplify shared source inclusion via `*.cs` globs + `<Link>`.
…20260627094707947 to main (#1597)

Juno: check in to lego/hb_d72c5677-3f00-4225-b18e-0a1e8a8f5f0e_20260627094707947.
…20260628094630378 to main (#1598)

Juno: check in to lego/hb_d72c5677-3f00-4225-b18e-0a1e8a8f5f0e_20260628094630378.
…20260629094703468 to main (#1599)

Juno: check in to lego/hb_d72c5677-3f00-4225-b18e-0a1e8a8f5f0e_20260629094703468.
This PR contains work to prepare for enabling nullable reference types in MICore. Changes:

- Correct two incorrect annotations in DebugEngineHost
- Refactor MICommandFactory to use constructor injection (readonly _debugger field)
- Move MICommandFactory.GetInstance() from DebuggedProcess to Debugger constructor
- Fix bug: firstException should only be set when null (was checking != null)
- Add null safety: _transport?.Close(), ThreadCreatedEvent?.Invoke, ThreadExitedEvent?.Invoke
- Add null throw in SendToTransport for null transport
- Use GetTargetProcessExitedReason() instead of raw _closeMessage
- Null-safe access to _initialErrors/_initializationLog in OnDebuggerProcessExit
- Pass EventArgs.Empty instead of null for DebuggerExitEvent
- Use pattern matching for IsModuleLoad check
- Make _commandLock readonly, initialize _lastCommandText
- Add <Nullable>enable</Nullable> to MICore.csproj
- Add GlobalUsings.cs with NullableHelpers static import
- Add NullableAttributes.cs shared file
- Add nullable annotations (?) to all appropriate type declarations
- Add [NotNullWhen], [DoesNotReturn] attributes
- Add Debug.Assert statements for non-null invariants
- Replace string.IsNullOrEmpty/IsNullOrWhiteSpace with NullableHelpers versions
- Add using System.Diagnostics where needed for Debug class
- Remove redundant using aliases replaced by GlobalUsings

This also cleans up the code in `PipeTransport.ExecuteSyncCommand` as that code had the classic Process.Start deadlock
This PR fixes a race condition in Microsoft.DebugEngineHost.RegisteryMonitor where if `Stop` was called before the monitor thread started, it would never shutdown.

This fixes #1593
…1601)

Gate the memoryReference on pointer and array types in OpenDebugAD7

A non-pointer scalar shown in a data tip or the Variables view carried a
memoryReference, so VS Code rendered the "view binary data" icon and
navigated to an address equal to the value (hovering a uint32_t of 1
opened a memory view at 0x1).

The earlier approach gated AD7Property.GetMemoryContext in the engine, but
that method is shared with Visual Studio, where the Memory and Disassembly
windows resolve a typed address expression through it. Restricting it
there breaks entering a scalar or address expression into those windows.

Move the restriction to the DAP layer: in
AD7Utils.GetMemoryReferenceFromIDebugProperty, emit a memoryReference only
when the property type is a pointer or an array. GetMemoryContext is left
unchanged, so the Visual Studio memory and disassembly navigation keep
working, while VS Code no longer offers a memory view for scalars. VS Code
has no free-form address entry, so gating the reference removes no entry
point there.
…1605)

Synthetic frames produced by GDB's FrameFilter, e.g. async stack backtraces for C++20 coroutines produced by a [GDB script](https://github.com/tzcnt/tmc-examples/blob/backtrace/coro_backtrace_gdb.py) do not have a `Level` and cannot be assigned a `Level` with the current version of GDB. Attempting to set a breakpoint inside of an async stack then causes an error when walking the synthetic backtrace:

```
ERROR: Error while trying to enter break state. Debugging will now stop. Unrecognized format of field "level" in result: {addr=0x000055555555fef0,func=[async] main::$_0::operator()(unsigned long) const [clone .destroy],file=<file>,line=80,arch=i386:x86-64}
```

This PR updates MIEngine’s callstack and expression-evaluation paths to tolerate GDB FrameFilter “synthetic” frames that omit the `level` field, avoiding stack-walk failures and guarding frame-relative MI commands (locals/args/registers/eval) when the frame is not addressable by level.

**Changes:**
- Make `ThreadContext.Level` nullable and update stack walking/parsing to allow frames without `level`.
- Add defensive guards across locals/args/registers/expression evaluation paths when `Level == null`.
- Introduce a user-facing resource string for unsupported evaluation scenarios in non-level-bearing frames.
## Why is this change being made

This PR fixes the way we deploy the debug adapter for CppTests so that you don't need to rerun CI-Build.ps1/.sh between test iterations. This way you can make a code change, then run a test from the command line, from Test Explorer in Visual Studio, or the Testing panel in VS Code.

## Summary of changes

- Removed steps from CI-Build.ps1/.sh to publish OpenDebugAD7
- Added targets to CppTests.csproj to deploy the debug adapter
- Added project references so that building CppTests.csproj will ensure all the other projects are built
- Removed solution build dependencies from the .sln files since they are now in the .csproj files
- Added code to copy config.xml in test/CppTests project directory
- Updated documentation from the changes

Unrelated, but I also added src/MIDebugEngine-Unix.sln as the default solution in VS Code

## Testing

* [X] **.NET CLI**: ran `git clean`, copied in the correct config.xml, and verified I could run a test using `dotnet test`
* [X] **Visual Studio**: ran `git clean`, copied in the correct config.xml, and verified I could run a test
* [X] **Visual Studio**: made a change to DebuggedProcess.cs, then rerun a test and verified my new code was running
* [X] **Visual Studio Code**: cloned the repo into WSL, copied in the correct config.xml, opened the workspace and verified I could run tests from the Testing pannel.
This PR adds support for an `Environment` dictionary in config.xml to make it easy to configure cygwin tests on Windows.
Fix UI-thread hang when resuming the target during launch
…20260815094702654 to main (#1615)

Juno: check in to lego/hb_d72c5677-3f00-4225-b18e-0a1e8a8f5f0e_20260815094702654.
…20260816094627420 to main (#1616)

Juno: check in to lego/hb_d72c5677-3f00-4225-b18e-0a1e8a8f5f0e_20260816094627420.
## Summary

This PR pins GitHub Actions to full-length commit SHAs for improved security and reproducibility and adds a 7 day cooldown to Dependabot configuration for GitHub Actions. This work is described in more detail at https://aka.ms/action-pinning.

## Why?

Pinning actions to commit SHAs prevents supply-chain attacks where a tag could be moved to point to malicious code. This is a recommended security best practice per the [GitHub Actions security hardening guide](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions).

This change mitigates the risk of tag retargeting to malicious code as seen in incidents like the [tj-actions/changed-files action compromise](https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised) or [codfish/semantic-release-action compromise](https://www.stepsecurity.io/blog/supply-chain-compromise-codfish-semantic-release-action) and improves the integrity and reproducibility of the CI/CD pipeline.

## What changed?

**Action pinning:** Third-party action references in `.github/workflows/` that used mutable tag-based references (e.g., `actions/checkout@v4`) have been updated to full-length commit SHAs with a version comment (e.g., `actions/checkout@<sha> # v4`) using the [pinact](https://github.com/suzuki-shunsuke/pinact) tool. References that were already pinned to a SHA, or that used immutable release tags, were left unchanged.

**Dependabot configuration:** `.github/dependabot.yml` has been updated to ensure a `github-actions` package-ecosystem section is present with a `cooldown` configuration (`default-days: 7`). If the file did not exist, it was created. If a `github-actions` section already existed, only the `cooldown` block was added or its `default-days` value was increased to 7 if it was lower. The 7-day cooldown provides a window for the community to detect and report compromised releases before they are automatically proposed as updates, reducing exposure to supply-chain attacks via newly published malicious versions.

## Is this safe to merge?

Yes. The pinned SHAs correspond to the same commits that the existing tags pointed to. No behavioral changes in action execution are introduced. You can verify the pinned SHA value using the GitHub REST API (e.g., the commit hash for `actions/checkout@v7` can be found in the `sha` property in the JSON response for `GET https://api.github.com/repos/actions/checkout/commits/v7`).

## Additional Information

For more information, please see https://aka.ms/action-pinning
Bumps the github-actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.4.0` | `7.0.1` |
| [actions/setup-dotnet](https://github.com/actions/setup-dotnet) | `4.3.1` | `6.0.0` |
| [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) | `2.0.0` | `3.0.0` |
| [NuGet/setup-nuget](https://github.com/nuget/setup-nuget) | `2.0.2` | `3.1.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.2` | `7.0.1` |


Updates `actions/checkout` from 4.4.0 to 7.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@11d5960...3d3c42e)

Updates `actions/setup-dotnet` from 4.3.1 to 6.0.0
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](actions/setup-dotnet@67a3573...a98b568)

Updates `microsoft/setup-msbuild` from 2.0.0 to 3.0.0
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Commits](microsoft/setup-msbuild@6fb0222...30375c6)

Updates `NuGet/setup-nuget` from 2.0.2 to 3.1.0
- [Release notes](https://github.com/nuget/setup-nuget/releases)
- [Commits](NuGet/setup-nuget@d105a94...b26b823)

Updates `actions/upload-artifact` from 4.6.2 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@ea165f8...043fb46)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/setup-dotnet
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: microsoft/setup-msbuild
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: NuGet/setup-nuget
  dependency-version: 3.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1621)

Bumps the github-actions group with 1 update: [NuGet/setup-nuget](https://github.com/nuget/setup-nuget).


Updates `NuGet/setup-nuget` from 3.1.0 to 4
- [Release notes](https://github.com/nuget/setup-nuget/releases)
- [Commits](NuGet/setup-nuget@b26b823...fd55a6f)

---
updated-dependencies:
- dependency-name: NuGet/setup-nuget
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

7 participants