Skip to content

[release/10.0] Fix Windows service test-helper process-handle race - #137930

Merged
lewing merged 2 commits into
release/10.0from
lewing-backport-137025-release-10
Nov 20, 2026
Merged

lewing merged 2 commits into
release/10.0from
lewing-backport-137025-release-10

Conversation

@lewing

@lewing lewing commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Fixes Issue #136992

main PR #137025

Description

Test-only backport of 9ae326e.

Keep the process local until its SafeHandle has been acquired, then assign it to the remote invocation handle. If the service process exits before handle acquisition, dispose the temporary Process and leave the remote invocation handle's Process unset. This prevents a later cleanup failure caused by storing a Process without an acquired handle.

The WindowsServiceTester.cs backport is unchanged from upstream. Also correct one existing System.Net.Sockets test annotation from the unavailable PlatformDetection.IsMultithreadingSupported to release/10.0's existing PlatformDetection.IsThreadingSupported. This test-only branch compatibility fix addresses the CS0117 compilation error reported in 12 CI build legs. No product code changes.

Customer Impact

No shipped product behavior changes. Without this fix, Windows service tests can fail intermittently when the service exits during test-helper startup. The socket annotation correction unblocks compilation of the library tests on release/10.0.

Regression

The same test-helper race exists on release/10.0. It has not been established as a regression introduced in the most recent release. The socket test annotation references a helper absent from this servicing branch.

Testing

  • dotnet build src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj --nologo -v:minimal failed because the local shared-framework targeting pack has not been built.
  • dotnet build src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj -p:UseLocalTargetingRuntimePack=false --nologo -v:minimal passed on macOS, with zero warnings and zero errors, producing both net10.0-windows and net481 test assemblies.
  • dotnet build src/libraries/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj -p:UseLocalTargetingRuntimePack=false --nologo -v:minimal passed on macOS after correcting the threading annotation, with zero warnings and zero errors, producing net10.0-windows, net10.0-unix, net10.0-browser and net10.0-wasi test assemblies.
  • git diff --check passed. The Windows service helper patch matches the source commit.

These are compile-only checks using SDK targeting packs and installed SDK 11.0.100-preview.6.26351.102 via the branch's allowed major roll-forward; they are not daily-runtime verification. The full clr+libs baseline build was skipped for these test-only changes. No tests were executed locally, including Windows service tests, which require Windows. Runtime verification is deferred to PR CI. The initial CI run's runtime-dev-innerloop passed; the main pipeline encountered the socket annotation compile failure addressed by the follow-up commit.

Risk

Low risk: an unchanged upstream fix confined to the Windows service test helper, plus a one-line test annotation correction using the servicing branch's existing threading capability check. The helper publishes a Process only after handle acquisition succeeds and disposes it on the process-exit race. No shipping code or public APIs change.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

@lewing lewing added area-Extensions-Hosting test-bug Problem in test source code (most likely) labels Nov 19, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-hosting
See info in area-owners.md if you want to be subscribed.

@lewing lewing added the Servicing-approved Approved for servicing release label Nov 19, 2026
@lewing
lewing enabled auto-merge (squash) November 19, 2026 17:48
Use release/10.0 PlatformDetection.IsThreadingSupported to unblock library test compilation.

Co-authored-by: Copilot App <[email protected]>
@lewing

lewing commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

/ba-g corrected pattern in #137887 and back porting 135751 to track untracked failures

@lewing
lewing merged commit 6f4ac90 into release/10.0 Nov 20, 2026
91 of 93 checks passed
@lewing
lewing deleted the lewing-backport-137025-release-10 branch November 20, 2026 01:05
jkotas pushed a commit that referenced this pull request Nov 20, 2026
…37953)

Fixes Issue <!-- Issue Number --> N/A; test-only backport of the fix for
#133418.

main PR <!-- Link to PR if any that fixed this in the main branch. -->
#135751

# Description

<!-- Give a brief summary of the issue and how the pull request is
fixing it. -->

Backport 7abf5fa to release/10.0. Add
`[Collection(nameof(DisableParallelization))]` to
`SslStreamTlsResumeTests` and compile the existing collection-definition
helper into the test assembly. This prevents other test collections from
interfering with the TLS session-cache state used across connections.

The three-line change is equivalent to main; the attribute is placed
inside the existing .NET 10 `#if DEBUG` block. No product code changes.

# Customer Impact

<!-- What is the impact to customers of not taking this fix? -->

No direct product impact. TLS resumption test flakiness can fail
servicing CI and delay unrelated changes.

Build 1690727 for #137930 failed
`NoClientCert_DefaultValue_ResumeSucceeds(sslProtocol: Tls12)` on
Ubuntu.2604.Amd64.Open with Expected True / Actual False at
`RunConnectionAsync`. This backport is a candidate mitigation, not a
proven fix for that failure:
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1690727&view=ms.vss-test-web.build-test-results-tab&runId=47200416&resultId=153252

The source PR resolved #133418 (`DifferentEncryptionPolicy_NoResume`).
Historical #103354 involved Ubuntu 18.04/OpenSSL and does not establish
the cause of the current Ubuntu 26.04 failure.

# Regression

<!-- Is this fixing a problem that was introduced in the most recent
release, ie., fixing a regression? -->

No newly introduced product regression identified. This brings existing
test isolation from main (merged October 14, 2026) to release/10.0.

# Testing

<!-- What kind of testing has been done with the fix. -->

- `./dotnet.sh --version`: 10.0.115, matching `global.json`.
- `./dotnet.sh build
src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj
-c Debug -p:RuntimeConfiguration=Release
-p:UseLocalTargetingRuntimePack=false -v:minimal`: passed on macOS
arm64; 0 warnings, 0 errors. Compiled net10.0-windows, net10.0-unix,
net10.0-osx, net10.0-ios, and net10.0-browser variants against the
installed SDK targeting pack.
- `git diff --check`: passed.
- The initial project build without
`-p:UseLocalTargetingRuntimePack=false` failed because the local
shared-framework targeting pack was not built. The successful command
above uses the SDK reference pack instead.
- An initial `./build.sh clr+libs -rc release` baseline on main was
stopped at the user's request; a runtime rebuild is unnecessary for this
test-only change.
- No tests were executed. The affected class is Debug-only and
Windows/Linux-only; macOS compilation does not validate Windows/Ubuntu
behavior or prove that the reported failure is fixed.

# Risk

<!-- Please assess the risk of taking this fix. Provide details backing
up your assessment. -->

Low: only test scheduling and inclusion of the existing xUnit collection
definition change. The collection runs without other parallel
collections, which may increase test duration. Product binaries and
public APIs are unchanged.

# Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet
package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older
versions.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Extensions-Hosting Servicing-approved Approved for servicing release test-bug Problem in test source code (most likely)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants