Skip to content

Modern PR pipeline does not exercise managed SNI for Unit/Functional tests #4605

Open

Description

@paulmedynski

Summary

The modern PR pipeline (eng/pipelines/pr/) runs TestSqlClientUnit and TestSqlClientFunctional with no managed/native SNI dimension at all, so managed SNI on Windows is never exercised for these suites during PR validation.

Background

LocalAppContextSwitches.UseManagedNetworking selects the SNI implementation in TdsParserStateObjectFactory, and also branches in TdsParser and TdsParserStateObject. It is controlled by the Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows AppContext switch (Windows + .NET only; .NET Framework always uses native SNI, non-Windows always uses managed).

The Unit test suite contains the densest SNI coverage in the repo. SimulatedServerTests open real TCP connections to an in-process TdsServer, including tests written specifically for SNI behaviour:

  • SNICloseDeadlockTest
  • SNICloseRaceDeadlockTest
  • SNICloseHandshakeCancellationTest
  • plus SSPI, failover, routing, feature-negotiation, and TDS token-bounds tests

Functional tests also reach the SNI layer, though more lightly (e.g. LocalizationTest starts a TdsServer and opens a connection).

Current state

Pipeline SNI dimension Effective for Unit/Functional
eng/pipelines/pr/ (modern PR) none no
dotnet-sqlclient-ci-core.yml (legacy CI) useManagedSNI: [false, true] no — see below
sqlclient-pr-*-ref-pipeline.yml (legacy PR) useManagedSNI no — see below
sqlclient-ci-unit (new) useManagedSNI yes, once #4506 merges

The legacy pipelines pass UseManagedSNIOnWindows into update-config-file-step.yml, which writes config.jsonc. That file is only read by DataTestUtility (ManualTests), the Azure extension tests, and PerformanceTests. Because legacy jobs run Unit, Functional, and Manual in the same job via run-all-tests-step.yml, the toggle takes effect for the Manual portion only — the Unit and Functional runs in a "ManagedSNI" leg still execute against native SNI.

Proposed fix

Mirror the approach landing in #4506 for the new sqlclient-ci-unit pipeline: set the AppContext switch through the test host's runtime configuration (RuntimeHostConfigurationOption) rather than through config.jsonc, driven by a UseManagedSniOnWindows build property threaded from the pipeline into build.proj.

For the modern PR pipeline specifically, add a managed-SNI dimension to the Windows Unit/Functional legs in eng/pipelines/pr/stages/test-stages.yml (via test-buildproj-job.yml), weighed against PR-validation runtime budget. A reduced matrix (for example, a single representative TFM) may be the right trade-off.

Notes

  • The legacy CI and PR pipelines are intentionally being left alone; the new sqlclient-ci-unit pipeline closes the coverage gap for CI.
  • net462 should be excluded, since .NET Framework only supports native SNI.
  • This combination has never run in CI, so the first enabling run may surface latent failures.

Related

Activity

  1. added
    Area\Engineering
    on Aug 27, 2026
  2. added this to the 8.0.0-preview1 milestone on Aug 27, 2026
  3. github-actions commented on Aug 27, 2026

    @github-actions

    🔍 Triage Summary

    Check Result
    Issue type Task
    Environment N/A — infrastructure/pipeline task, no runtime environment required
    Area Area\Engineering
    Duplicates Potentially related: #4506 (mentioned as prerequisite/companion)
    Regression Not indicated

    Analysis

    This task identifies a gap in the modern PR pipeline (eng/pipelines/pr/) where the TestSqlClientUnit and TestSqlClientFunctional suites run exclusively against native SNI on Windows, because the UseManagedNetworkingOnWindows AppContext switch is never set for those test hosts. The SNI-specific tests in SimulatedServerTests (deadlock, race, handshake cancellation, etc.) are therefore never validated against managed SNI during PR gating. The proposed fix mirrors the RuntimeHostConfigurationOption-based approach from #4506 and adds a managed-SNI matrix dimension to the Windows legs of test-stages.yml, with a reduced TFM matrix to keep PR runtime reasonable. Severity: P2 — ongoing coverage blind spot that could mask managed SNI regressions.

    Next Steps

    • Assign to the Copilot coding agent to implement the pipeline change. The agent should:
      1. Confirm Add Unit and Functional test CI pipeline #4506 has merged (or coordinate the dependency) so the UseManagedSNIOnWindows build property and RuntimeHostConfigurationOption injection exist in build.proj.
      2. In eng/pipelines/pr/stages/test-stages.yml (and test-buildproj-job.yml if needed), add a useManagedSNI: [false, true] matrix variable for the Windows Unit and Functional legs, threaded as a build property to build.proj.
      3. Exclude net462 from the managed-SNI matrix leg, as .NET Framework only supports native SNI.
      4. Use a single representative .NET TFM (e.g. net9.0) for the managed-SNI leg to minimise PR runtime impact.
      5. Validate that the sqlclient-ci-unit pipeline's managed-SNI approach (Add Unit and Functional test CI pipeline #4506) is consistent with this change.

    Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.

    Generated by SqlClient Issue Auto-Triage for issue #4605 · 30.5 AIC · ⌖ 6.46 AIC · ⊞ 8.6K · ◷

  4. moved this from To triage to Backlog in SqlClient Boardon Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area\Engineering

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions