Skip to content

[DO NOT MERGE] [8.0.0 Cherry-pick] Connection encryption info – Slice A: public API surface - #5103

Draft
priyankatiwari08 wants to merge 1 commit into
release/8.0from
dev/automation/pr-4830-to-8.0.0-v2
Draft

priyankatiwari08 wants to merge 1 commit into
release/8.0from
dev/automation/pr-4830-to-8.0.0-v2

Conversation

@priyankatiwari08

@priyankatiwari08 priyankatiwari08 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Important

DO NOT MERGE. The connection-encryption info feature (#2353) will land in release/8.0 as a whole, only after all slices have merged to main (remaining: Slice C #4835 and Slice D #4836). An earlier Slice A cherry-pick (#5037) was merged and then reverted by #5090 for this reason. This PR is up for review now so the 8.0 port is ready when the feature is complete.

8.0.0 cherry-pick of Slice A of the connection-encryption info feature: #4830 (main d8a60de2f) together with its review follow-up #5043 (main 8d330f187).

This branch is git revert 4fdc66981 on top of release/8.0 — i.e. it re-applies the revert (#5090) of #5037, which was already reviewed and merged into release/8.0. The re-applied patch is byte-identical to #5037 (b99cd8329).

Adds the public API surface: SqlConnection.EncryptionInfo, SqlConnectionEncryptionInfo, SqlConnectionEncryptionMode, SqlServerCertificateValidationErrors, and SqlException encryption info, plus ref/NotSupported updates, docs, and unit tests.

Stack order (each PR is based on the previous one; merge bottom-up):

  1. [DO NOT MERGE] [8.0.0 Cherry-pick] Connection encryption info – Slice A: public API surface #5103 — Slice A: public API surface (Connection encryption info – Slice A: public API surface #4830) + Slice A review follow-up (Connection encryption info – Slice A review follow-up #5043), base release/8.0
  2. [DO NOT MERGE] [8.0.0 Cherry-pick] Connection encryption info – Slice B: negotiated mode and TLS protocol #5102 — Slice B: negotiated mode and TLS protocol (Connection encryption info – Slice B: negotiated mode and TLS protocol #4831), base dev/automation/pr-4830-to-8.0.0-v2

A separate PR for the Slice A review follow-up (#5043) is not needed: #5037 already contained every #5043 change. git cherry-pick -x 8d330f187 on top of PR1 produced an empty commit, and all 15 files touched by #5043 are byte-identical between main@8d330f187 and this branch. (The earlier auto cherry-pick #5055 was closed unmerged.)

Conflicts

None. git revert 4fdc66981 applied cleanly on release/8.0 (323663d50).

Issues

Ports #4830 and #5043 to release/8.0. Feature: #2353. Previous attempt: #5037 (reverted by #5090).

Testing

Build (0 warnings, 0 errors each):

  • dotnet build build.proj -t:BuildSqlClient (driver, ref, NotSupported) — succeeded, 0 warnings, 0 errors
  • dotnet build src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj — succeeded, 0 warnings, 0 errors
  • dotnet build src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTests.csproj — succeeded, 0 warnings, 0 errors

Focused unit tests ($f = 'FullyQualifiedName~EncryptionInfo|FullyQualifiedName~EncryptionInfoAccumulator|FullyQualifiedName~ConnectionEncryptionInfo|FullyQualifiedName~SqlConnectionTests|FullyQualifiedName~SqlExceptionTest'):

  • dotnet test src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj --no-build -f passed: 53/53, 0 failed, 0 skipped.0 --filter $f — passed: 53/53, 0 failed, 0 skipped
  • dotnet test src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj --no-build -f passed: 57/57, 0 failed, 0 skipped --filter $f --blame-hang-timeout 5m (with a clean Windows PowerShell PSModulePath) — passed: 57/57, 0 failed, 0 skipped

Guidelines

Please review the contribution guidelines before submitting a pull request:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

This API-only slice has an explicit merge hold pending maintainer confirmation of complete-feature integration, coordinated release readiness, and managed/native SNI validation.

No open issues 🎉

What changed in this PR

Reapplies the Slice A public API and review follow-up for connection-encryption diagnostics to release/8.0, supporting #2353. This slice exposes empty snapshots; later slices populate negotiated encryption and certificate details. The PR remains marked DO NOT MERGE until the complete feature is ready.

Changes:

  • Adds immutable encryption snapshots, encryption-mode and validation-error enums, and connection/exception accessors.
  • Updates reference APIs and unsupported-platform generation for the new surface.
  • Adds API documentation and tests for snapshot semantics, certificate ownership, cloning, and serialization.
File Description
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Utilities/​EncryptionInfoTestData.cs Provides shared certificate data and snapshot assertions.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Microsoft/​Data/​SqlClient/​SqlExceptionTests.cs Tests snapshot access, cloning, serialization, and unchanged messages.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Microsoft/​Data/​SqlClient/​SqlConnectionTests.cs Tests empty snapshots before opening and after close/disposal.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Microsoft/​Data/​SqlClient/​SqlConnectionEncryptionInfoTests.cs Tests snapshot contracts, cipher values, and certificate isolation.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlServerCertificateValidationErrors.cs Defines certificate-validation error flags.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlException.cs Adds a non-serialized snapshot preserved by internal cloning.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlConnectionEncryptionMode.cs Defines negotiated encryption modes.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlConnectionEncryptionInfo.cs Implements immutable snapshots and caller-owned certificate retrieval.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlConnection.cs Exposes the empty encryption snapshot accessor.
src/​Microsoft.Data.SqlClient/​ref/​Microsoft.Data.SqlClient.cs Declares the new public API across target frameworks.
src/​Microsoft.Data.SqlClient/​notsupported/​Microsoft.Data.SqlClient.csproj Configures GenAPI header and attribute exclusions.
src/​Microsoft.Data.SqlClient/​notsupported/​GenApiHeader.txt Enables nullable annotations in generated stubs.
src/​Microsoft.Data.SqlClient/​notsupported/​GenApiExcludeAttributes.txt Excludes compiler-owned nullable metadata attributes.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlServerCertificateValidationErrors.xml Documents validation-error flag meanings.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlException.xml Documents exception snapshot availability and serialization behavior.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlConnectionEncryptionMode.xml Documents negotiated encryption modes.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlConnectionEncryptionInfo.xml Documents snapshot values, null semantics, and certificate ownership.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlConnection.xml Documents the intended connection snapshot lifecycle.
doc/​design-notes/​2353-connection-encryption-info.md Records the API design, diagnostic guarantees, and implementation slices.

Review effort: Balanced

@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.43%. Comparing base (463a45c) to head (3d57949).
⚠️ Report is 13 commits behind head on release/8.0.

Additional details and impacted files
@@               Coverage Diff               @@
##           release/8.0    #5103      +/-   ##
===============================================
+ Coverage        68.97%   72.43%   +3.46%     
===============================================
  Files              314      314              
  Lines            45857    71062   +25205     
===============================================
+ Hits             31629    51474   +19845     
- Misses           14228    19588    +5360     
Flag Coverage Δ
CI-SqlClient ?
sqlclient-pr 72.43% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdaigle
mdaigle marked this pull request as draft November 19, 2026 04:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

4 participants