Skip to content

Run COM runtime tests on GitHub Actions windows-latest#1734

Merged
jevansaks merged 1 commit into
mainfrom
user/jevansa/enable-com-runtime-tests
Jun 17, 2026
Merged

Run COM runtime tests on GitHub Actions windows-latest#1734
jevansaks merged 1 commit into
mainfrom
user/jevansa/enable-com-runtime-tests

Conversation

@jevansaks

@jevansaks jevansaks commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

The COM/Direct2D/WMI/Shell runtime tests were tagged RequiresHardware (formerly FailsInCloudTest) and excluded from all CI. That meant we only ever verified that the generated projection compiled — never that it actually works at runtime through the .NET / source-generated COM marshalers. This PR makes those tests run on GitHub Actions.

Root cause (why they were excluded)

Archeology shows the original failures were on the locked-down Azure DevOps 1ES build pool (microbuild agents) — first disabled in 2024 (7e10c766 "Disable test that fails on microbuild agents"), then carried forward defensively. Those agents lack:

  • an interactive desktop session (Shell/Explorer COM servers)
  • a GPU (D2D1_RENDER_TARGET_TYPE_DEFAULT)
  • some WMI providers (Defender namespace)

GitHub-hosted windows-latest runners do not have those limitations. Empirically, all 14 tests run and pass there (Skipped: 0).

Changes

  • New gating test-hardware-windows job runs the RequiresHardware tests on windows-latest and is wired into the required validate check — so PRs now exercise the real runtime code paths.
  • Keep the RequiresHardware trait so the Azure DevOps 1ES pool (dotnet-test-cloud.ps1) continues to exclude these tests (per maintainer guidance — it's fine for the DevDiv outer loop to keep skipping them).
  • Direct2D tests use WARP (D2D1_RENDER_TARGET_TYPE_SOFTWARE) — same render-target creation + HWND marshaling code paths, no hardware GPU required.
  • No graceful Assert.Skip fallbacks — if a test regresses or the environment changes, the job fails loudly instead of silently skipping. (This reverts the earlier fallback approach.)
  • Fix misleading trait comments, including a copy-paste // WMI APIs don't work in cloud VMs. comment on CanCallIDispatchOnlyMethods (a Shell-only test, not WMI).

Tests now exercised in CI

Test What it validates at runtime
ReturnValueMarshalsCorrectly ×3 D2D struct-return marshaling (via WARP)
IWbemServices_GetObject_Works ×2 optional out-interface args (WMI)
CanCallINetFwMgrApis ×2 IDispatch/variant marshaling (Firewall)
CanCallIDispatchOnlyMethods IDispatch property returns (Shell)
RemotableInterface non-remotable COM pointer overloads (Shell)
CanCallPnPAPIs SetupDi span/out overloads
IShellItem_BindToHandler_IStream_ReadWorks ×2 inherited-interface friendly overloads (#1716)
IShellItem_BindToHandler_GenericOverload, SHCreateItemFromParsingName_GenericOverload IID_PPV_ARGS generic overloads at runtime

Validation

  • All 14 tests pass locally and on GitHub Actions windows-latest (Skipped: 0).
  • The Azure DevOps 1ES loop (incl. DevDiv CsWin32 unofficial #25100) continues to exclude them via the existing RequiresHardware filter, so the official build stays green.

@jevansaks jevansaks force-pushed the user/jevansa/enable-com-runtime-tests branch from b90ba0e to 4950ec6 Compare June 16, 2026 19:10
The COM/Direct2D/WMI/Shell runtime tests were tagged RequiresHardware
(formerly FailsInCloudTest) and excluded from ALL CI, so we only ever
verified that the generated projection compiled -- never that it actually
works at runtime through the .NET / source-generated COM marshalers.

The original failures were on the locked-down Azure DevOps 1ES build pool
(microbuild agents) which lack an interactive desktop, GPU, and some WMI
providers. GitHub-hosted windows-latest runners do NOT have those
limitations: they run an interactive session, Defender's WMI provider, the
firewall service, and can drive Direct2D via the WARP software rasterizer.

Changes:
- Add a gating `test-hardware-windows` job that runs the RequiresHardware
  tests on windows-latest so the real runtime code paths are exercised in
  PRs. Wire it into the `validate` required check.
- Keep the RequiresHardware trait so the Azure DevOps 1ES pool
  (dotnet-test-cloud.ps1) continues to exclude these tests.
- Direct2D ReturnValueMarshalsCorrectly tests now create a
  D2D1_RENDER_TARGET_TYPE_SOFTWARE (WARP) render target so they exercise the
  same render-target creation + HWND marshaling without a hardware GPU.
- No graceful Assert.Skip fallbacks: if a test regresses or the environment
  changes, the job fails loudly rather than silently skipping.
- Fix misleading trait comments (including a copy-paste "WMI" comment on a
  Shell-only test) to document the real ADO-1ES-vs-GitHub rationale.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jevansaks jevansaks force-pushed the user/jevansa/enable-com-runtime-tests branch from 4950ec6 to 5d4fdc5 Compare June 16, 2026 22:43
@jevansaks jevansaks changed the title Enable COM runtime tests in CI PR gates Run COM runtime tests on GitHub Actions windows-latest Jun 16, 2026
@jevansaks jevansaks marked this pull request as ready for review June 17, 2026 01:54
@jevansaks jevansaks enabled auto-merge (squash) June 17, 2026 01:54
@jevansaks jevansaks merged commit e4a7320 into main Jun 17, 2026
20 checks passed
@jevansaks jevansaks deleted the user/jevansa/enable-com-runtime-tests branch June 17, 2026 17:40
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.

2 participants