Skip to content

Add type forwards to public Abstractions types#4067

Merged
cheenamalhotra merged 2 commits intomainfrom
dev/cheena/sqlauthmethod
Mar 26, 2026
Merged

Add type forwards to public Abstractions types#4067
cheenamalhotra merged 2 commits intomainfrom
dev/cheena/sqlauthmethod

Conversation

@cheenamalhotra
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 19, 2026 16:18
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Mar 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds type forwarding metadata so key authentication-related types that were moved into the Microsoft.Data.SqlClient.Extensions.Abstractions assembly remain discoverable via the Microsoft.Data.SqlClient assembly, preserving backward-compat loading behavior.

Changes:

  • Introduces TypeForwards.Abstractions.cs with TypeForwardedTo attributes for Abstractions authentication types.
  • Adds a FunctionalTests regression test that loads the moved types via the SqlClient assembly.
  • Wires the new type-forward file into legacy netfx/netcore source projects and both netfx/netcore ref-assembly projects.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/tests/FunctionalTests/TypeForwardTests.cs Adds a functional regression test for loading Abstractions-moved types via Microsoft.Data.SqlClient assembly.
src/Microsoft.Data.SqlClient/src/TypeForwards.Abstractions.cs Adds assembly-level type-forward declarations for Abstractions authentication types.
src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj Includes the new type-forward file in the legacy netfx build inputs.
src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj Includes the new type-forward file in the netfx reference assembly build.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj Includes the new type-forward file in the legacy netcore build inputs.
src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj Includes the new type-forward file in the netcore reference assembly build.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/Microsoft.Data.SqlClient/src/TypeForwards.Abstractions.cs
Comment thread src/Microsoft.Data.SqlClient/tests/UnitTests/TypeForwardTests.cs
Comment thread src/Microsoft.Data.SqlClient/tests/UnitTests/TypeForwardTests.cs
Copy link
Copy Markdown
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

Looks good, with one comment, and I agree with Copilot's comments.

What scenario is this addressing? Do we support someone dropping our new DLLs into their existing app deployment and expecting things to work?

Comment thread src/Microsoft.Data.SqlClient/tests/UnitTests/TypeForwardTests.cs
@github-project-automation github-project-automation Bot moved this from To triage to In progress in SqlClient Board Mar 19, 2026
@paulmedynski paulmedynski self-assigned this Mar 19, 2026
@cheenamalhotra
Copy link
Copy Markdown
Member Author

What scenario is this addressing? Do we support someone dropping our new DLLs into their existing app deployment and expecting things to work?

Yes, this is for backwards compatibility in applications that load types by assembly reference.

@cheenamalhotra cheenamalhotra added this to the 7.0.1 milestone Mar 19, 2026
@cheenamalhotra cheenamalhotra marked this pull request as ready for review March 19, 2026 20:52
@cheenamalhotra cheenamalhotra requested a review from a team as a code owner March 19, 2026 20:52
Copilot AI review requested due to automatic review settings March 19, 2026 20:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds CLR type-forwards in Microsoft.Data.SqlClient for types that have moved into the Microsoft.Data.SqlClient.Extensions.Abstractions assembly, preserving backward compatibility for consumers that load these types from the original SqlClient assembly.

Changes:

  • Add TypeForwardedTo attributes for the public Abstractions authentication types.
  • Wire the new type-forward source file into netfx/netcore source + reference assembly builds.
  • Add a unit test ensuring the forwarded types still load via Microsoft.Data.SqlClient and resolve to the Abstractions assembly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/tests/UnitTests/TypeForwardTests.cs Adds a regression test validating forwarding resolves to the Abstractions assembly.
src/Microsoft.Data.SqlClient/src/TypeForwards.Abstractions.cs Introduces assembly-level type-forward declarations for Abstractions types.
src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj Includes the new type-forward source in the netfx build.
src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj Includes the type-forward source in the netfx reference assembly build.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj Includes the new type-forward source in the netcore build.
src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj Includes the type-forward source in the netcore reference assembly build.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.63%. Comparing base (ce38e64) to head (1489e2c).
⚠️ Report is 19 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (ce38e64) and HEAD (1489e2c). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (ce38e64) HEAD (1489e2c)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4067      +/-   ##
==========================================
- Coverage   75.09%   65.63%   -9.46%     
==========================================
  Files         280      275       -5     
  Lines       43830    65825   +21995     
==========================================
+ Hits        32914    43207   +10293     
- Misses      10916    22618   +11702     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 65.63% <ø> (?)

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

☔ View full report in Codecov by Sentry.
📢 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
Copy link
Copy Markdown
Contributor

mdaigle commented Mar 25, 2026

I guess then the expectation would be to forward every type added to the abstractions package in the future. It seems slightly more user friendly than forcing people to reference the abstractions package. Is there any way to forward all types from that package so that we don't have to keep this updated by hand?

@cheenamalhotra cheenamalhotra modified the milestones: 7.0.1, 7.1.0-preview1 Mar 26, 2026
@cheenamalhotra
Copy link
Copy Markdown
Member Author

I guess then the expectation would be to forward every type added to the abstractions package in the future. It seems slightly more user friendly than forcing people to reference the abstractions package. Is there any way to forward all types from that package so that we don't have to keep this updated by hand?

It's not a requirement for all abstraction package types to have type forwards in the MDS assembly, as the concern we have is for the types that continue to be referenced from the old MDS assembly in user applications - which on upgrade no longer exist and cause a breaking change.

@cheenamalhotra cheenamalhotra added the Hotfix Candidate 🚑 Issues/PRs that are candidate for backporting to earlier supported versions. label Mar 26, 2026
@cheenamalhotra cheenamalhotra merged commit 49db91a into main Mar 26, 2026
305 of 306 checks passed
@cheenamalhotra cheenamalhotra deleted the dev/cheena/sqlauthmethod branch March 26, 2026 21:11
@github-project-automation github-project-automation Bot moved this from In progress to Done in SqlClient Board Mar 26, 2026
Ghostdog02 pushed a commit to Ghostdog02/Lexiq that referenced this pull request Apr 27, 2026
Updated [DotNetEnv](https://github.com/tonerdo/dotnet-env) from 3.1.1 to
3.2.0.

<details>
<summary>Release notes</summary>

_Sourced from [DotNetEnv's
releases](https://github.com/tonerdo/dotnet-env/releases)._

## 3.2.0

- Switch parsing to Superpower (from Sprache)
- Fix utf8 parsing
- Interpolated variables parsing


Commits viewable in [compare
view](tonerdo/dotnet-env@v3.1.1...v3.2.0).
</details>

Updated
[Microsoft.AspNetCore.Authentication.Google](https://github.com/dotnet/dotnet)
from 10.0.6 to 10.0.7.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.Authentication.Google's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated [Microsoft.Data.SqlClient](https://github.com/dotnet/sqlclient)
from 7.0.0 to 7.0.1.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Data.SqlClient's
releases](https://github.com/dotnet/sqlclient/releases)._

## 7.0.1

This update brings the following changes since the
[7.0.0](https://github.com/dotnet/SqlClient/blob/release/7.0/release-notes/7.0/7.0.0.md)
release:

### Fixed

- Fixed `SqlBulkCopy` failing on SQL Server 2016 with `Invalid column
name 'graph_type'` error. The column metadata query now uses dynamic SQL
so that references to the `graph_type` column (introduced in SQL Server
2017) are not compiled on older versions that lack the column.
([#​3714](dotnet/SqlClient#3714),
[#​4092](dotnet/SqlClient#4092),
[#​4147](dotnet/SqlClient#4147))

- Fixed `SqlBulkCopy` failing on Azure Synapse Analytics dedicated SQL
pools. The column-list query previously used a variable-assignment
pattern that Synapse does not support; it now uses `STRING_AGG` when
targeting Synapse (engine edition 6) and falls back to the
variable-assignment approach for SQL Server 2016 compatibility.
([#​4149](dotnet/SqlClient#4149),
[#​4176](dotnet/SqlClient#4176),
[#​4182](dotnet/SqlClient#4182))

- Fixed `SqlDataReader.GetFieldType()` and
`GetProviderSpecificFieldType()` returning `typeof(byte[])` instead of
`typeof(SqlVector<float>)` for vector float32 columns. The methods now
follow the same type-determination logic as `GetValue()`.
([#​4104](dotnet/SqlClient#4104),
[#​4105](dotnet/SqlClient#4105),
[#​4152](dotnet/SqlClient#4152))

- Added missing `System.Data.Common` (v4.3.0) NuGet package dependency
for .NET Framework consumers. The inbox `System.Data.Common` assembly on
.NET Framework predates APIs such as `IDbColumnSchemaGenerator`; without
the explicit NuGet dependency, consumers encountered `CS0012`
compilation errors when using these types through
`Microsoft.Data.SqlClient`.
([#​4063](dotnet/SqlClient#4063),
[#​4074](dotnet/SqlClient#4074))

### Changed

- Enabled the User Agent TDS feature extension unconditionally. The
`Switch.Microsoft.Data.SqlClient.EnableUserAgent` AppContext switch has
been removed; the driver now always sends User Agent information during
login. ([#​4124](dotnet/SqlClient#4124),
[#​4154](dotnet/SqlClient#4154))

- Added type forwards from the core `Microsoft.Data.SqlClient` assembly
to public types that were moved to the
`Microsoft.Data.SqlClient.Extensions.Abstractions` package:
`SqlAuthenticationMethod`, `SqlAuthenticationParameters`,
`SqlAuthenticationProvider`, `SqlAuthenticationProviderException`, and
`SqlAuthenticationToken`. This ensures binary compatibility for
assemblies compiled against earlier versions of
`Microsoft.Data.SqlClient` where these types lived in the core assembly.
([#​4067](dotnet/SqlClient#4067),
[#​4117](dotnet/SqlClient#4117))

- Fixed API documentation include paths and duplicate doc snippets.
([#​4084](dotnet/SqlClient#4084),
[#​4086](dotnet/SqlClient#4086),
[#​4107](dotnet/SqlClient#4107),
[#​4161](dotnet/SqlClient#4161))

## Contributors

We thank the following public contributors. Their efforts toward this
project are very much appreciated.

- [edwardneal](https://github.com/edwardneal)

## Target Platform Support

- .NET Framework 4.6.2+ (Windows x86, Windows x64, Windows ARM64)
- .NET 8.0+ (Windows x86, Windows x64, Windows ARM, Windows ARM64,
Linux, macOS)

### Dependencies

#### .NET 9.0

- Microsoft.Bcl.Cryptography 9.0.13
- Microsoft.Data.SqlClient.Extensions.Abstractions 1.0.0
- Microsoft.Data.SqlClient.Internal.Logging 1.0.0
- Microsoft.Data.SqlClient.SNI.runtime 6.0.2
- Microsoft.Extensions.Caching.Memory 9.0.13
- Microsoft.IdentityModel.JsonWebTokens 8.16.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 8.16.0
- Microsoft.SqlServer.Server 1.0.0
- System.Configuration.ConfigurationManager 9.0.13
- System.Security.Cryptography.Pkcs 9.0.13

#### .NET 8.0

- Microsoft.Bcl.Cryptography 8.0.0
- Microsoft.Data.SqlClient.Extensions.Abstractions 1.0.0
 ... (truncated)

Commits viewable in [compare
view](dotnet/SqlClient@v7.0.0...v7.0.1).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hotfix 7.0.1 When this PR merges, automatically open a PR to cherry-pick to the 7.0.1 branch

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Missing Type Microsoft.Data.SqlClient.SqlAuthenticationMethod - .NET Framework 4.8

4 participants