Skip to content

Upgrade to .NET 10 and Microsoft.Data.SqlClient 6.x#3656

Draft
souvikghosh04 wants to merge 1 commit into
mainfrom
Usr/sogh/upgrade-net10-sqlclient6
Draft

Upgrade to .NET 10 and Microsoft.Data.SqlClient 6.x#3656
souvikghosh04 wants to merge 1 commit into
mainfrom
Usr/sogh/upgrade-net10-sqlclient6

Conversation

@souvikghosh04

Copy link
Copy Markdown
Contributor

Joint runtime + driver bump to support new datatypes- JSON and Vector

WHY BOTH BUMPS ARE REQUIRED TOGETHER

SqlDbType.Json (numeric value 35) is a BCL enum value in System.Data, added in .NET 9 and present in .NET 10. It is NOT a Microsoft.Data.SqlClient symbol — SqlClient does not get to add values to a BCL enum it does not own. On .NET 8, the SqlDbType enum stops at DateTimeOffset = 34, so

Enum.TryParse<SqlDbType>("json", ignoreCase: true, out _)

in TypeHelper.GetSystemTypeFromSqlDbType returns false regardless of which SqlClient version is installed. The companion feature PR for #2768 plans to add a single dictionary entry

[SqlDbType.Json] = typeof(string)

which simply will not compile on net8.0. Both upgrades must therefore land together as a single prerequisite.

WHY .NET 10 AND NOT .NET 9

  • .NET 10 is the current Long-Term Support release (Nov 2025+).
  • .NET 9 is Standard-Term Support, EOL May 2026.
  • DAB's current .NET 8 line reaches EOL November 2026.

Going straight to LTS avoids a second forced upgrade inside 12 months.

SCOPE OF CHANGES (NO BEHAVIOR CHANGE INTENDED)

Runtime / SDK pin:

  • global.json: 8.0.420 -> 10.0.301

Target framework (all 11 src/**/*.csproj):

  • net8.0 -> net10.0

NuGet packages (Directory.Packages.props):

  • Microsoft.Data.SqlClient 5.2.3 -> 6.0.2
  • Microsoft.Extensions.Caching.Memory 8.0.1 -> 10.0.0
  • Microsoft.Extensions.Caching.Abstractions 9.0.0 -> 10.0.0
  • Microsoft.Extensions.Primitives 9.0.0 -> 10.0.0
  • Microsoft.Extensions.Configuration.Binder 9.0.0 -> 10.0.0
  • Microsoft.Extensions.Configuration.Json 9.0.0 -> 10.0.0
  • Microsoft.Extensions.Caching.StackExchangeRedis 9.0.3 -> 10.0.0

The Microsoft.Extensions.* bumps are required because OpenTelemetry's transitive chain (Microsoft.Extensions.Logging.Configuration 10.0.0) demands Configuration.Binder >= 10.0.0 — staying on 9.0.0 produces NU1605 package-downgrade errors (warning-as-error).

Service.csproj (Microsoft.NET.Sdk.Web) — drop now-redundant PackageReferences (NU1510, warning-as-error):

  • Microsoft.Extensions.Configuration.Binder (in shared framework)
  • Microsoft.Extensions.Configuration.Json (in shared framework)

Azure DevOps pipelines (9 occurrences across 8 files):

  • UseDotNet@2 version: 8.0.x -> 10.0.x

Container base images (Dockerfile):

  • mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0 -> 10.0-azurelinux3.0
  • mcr.microsoft.com/dotnet/aspnet:8.0-cbl-mariner2.0 -> 10.0-azurelinux3.0
    (cbl-mariner2.0 tag does not exist for .NET 9+; Azure Linux 3.0 is
    Microsoft's documented successor.)

Aspire AppHost (src/Aspire.AppHost/AppHost.cs):

  • WithArgs("-f", "net8.0") -> WithArgs("-f", "net10.0") (mssql + pg)

Build/publish scripts:

  • scripts/publish.ps1: $dotnetTargetFrameworks net8.0 -> net10.0
  • scripts/create-manifest-file.ps1: $dotnetTargetFrameworks + hashtable
    keys net8.0_{rid} -> net10.0_{rid}
    (TODO marker: release-engineering to
    confirm download URLs/hashes resolve)

License file rename:

  • external_licenses/Microsoft.Data.SqlClient.SNI.5.2.0.License.txt -> external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt
  • scripts/notice-generation.ps1: path updated to match
  • TODO marker at top of license file: contents still 5.2.0 text; release-engineering to refresh from upstream before merge.

SUPPRESSED ASPDEPR008 (warning-as-error) — DELIBERATE =====================================================

ASP.NET Core 10 deprecates IWebHostBuilder / IWebHost in favor of WebApplicationBuilder / IHost. Two locations in this repo still consume the obsolete types and would block compilation under the repo's TreatWarningsAsErrors=true setting:

  • src/Service/Program.cs (2 sites): test-only helpers CreateWebHostBuilder + CreateWebHostFromInMemoryUpdatableConfBuilder are consumed by the existing TestServer fixture which takes IWebHostBuilder.
  • src/Service.Tests/Configuration/ConfigurationTests.cs (3 sites): the consumer of those helpers.

Migrating from WebHost to HostBuilder/WebApplicationBuilder is a behavior-affecting refactor and explicitly OUT OF SCOPE for this no-behavior-change prerequisite PR. Suppression is added at the project level (NoWarn=ASPDEPR008 on Service.csproj + Service.Tests.csproj) with an inline TODO comment pointing at this branch and a follow-up issue link placeholder.

VALIDATION

dotnet --version : 10.0.301
dotnet restore --nologo : 11/11 projects restored (8.05s avg)
dotnet build -c Debug : 0 warnings, 0 errors, 10.32s

Multi-engine test categories (MsSql, PostgreSql, MySql, CosmosDb_NoSql, DwSql) were NOT run locally; they MUST run green on the Azure DevOps multi-engine matrix before this PR merges. That matrix is the gate.

NEXT STEPS BEFORE MERGE

  1. Release-engineering: refresh external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt from upstream for the SNI 6.0.0 version (currently still 5.2.0 text with a TODO marker at top).
  2. Release-engineering: confirm scripts/create-manifest-file.ps1 net10.0_{linux,win,osx}-x64 download URLs and SHA hashes resolve once the .NET 10 publish cycle runs.
  3. Multi-engine CI matrix runs green (MsSql, PostgreSql, MySql, CosmosDb_NoSql, DwSql) — that is the merge gate.
  4. File follow-up issue for ASPDEPR008 migration (WebHost -> WebApplicationBuilder / IHost) so the NoWarn suppressions can be removed in a future behavior-changing PR.

Why make this change?

  • Reference associated issue using # syntax. e.g. Closes #XX
    • Include summary (1-2 sentences) of linked issue to avoid redirecting reviewers to different pages.
    • Include links to any additional discussion threads related to this change.

What is this change?

  • Summary of how your changes work to give reviewers context of your intent.
    • Links to relevant documentation / StackOverflow, if applicable.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

  • Example REST and/or GraphQL request to demonstrate modifications
  • Example of CLI usage to demonstrate modifications

Joint runtime + driver bump that prerequisites issue #2768 (MSSQL JSON
data type support). Behavior-preserving — no production logic changes.

WHY BOTH BUMPS ARE REQUIRED TOGETHER
====================================

SqlDbType.Json (numeric value 35) is a BCL enum value in System.Data,
added in .NET 9 and present in .NET 10. It is NOT a Microsoft.Data.SqlClient
symbol — SqlClient does not get to add values to a BCL enum it does not
own. On .NET 8, the SqlDbType enum stops at DateTimeOffset = 34, so

    Enum.TryParse<SqlDbType>("json", ignoreCase: true, out _)

in TypeHelper.GetSystemTypeFromSqlDbType returns false regardless of
which SqlClient version is installed. The companion feature PR for #2768
plans to add a single dictionary entry

    [SqlDbType.Json] = typeof(string)

which simply will not compile on net8.0. Both upgrades must therefore
land together as a single prerequisite.

WHY .NET 10 AND NOT .NET 9
==========================

- .NET 10 is the current Long-Term Support release (Nov 2025+).
- .NET 9 is Standard-Term Support, EOL May 2026.
- DAB's current .NET 8 line reaches EOL November 2026.

Going straight to LTS avoids a second forced upgrade inside 12 months.

SCOPE OF CHANGES (NO BEHAVIOR CHANGE INTENDED)
==============================================

Runtime / SDK pin:
  - global.json: 8.0.420 -> 10.0.301

Target framework (all 11 src/**/*.csproj):
  - net8.0 -> net10.0

NuGet packages (Directory.Packages.props):
  - Microsoft.Data.SqlClient                    5.2.3  -> 6.0.2
  - Microsoft.Extensions.Caching.Memory         8.0.1  -> 10.0.0
  - Microsoft.Extensions.Caching.Abstractions   9.0.0  -> 10.0.0
  - Microsoft.Extensions.Primitives             9.0.0  -> 10.0.0
  - Microsoft.Extensions.Configuration.Binder   9.0.0  -> 10.0.0
  - Microsoft.Extensions.Configuration.Json     9.0.0  -> 10.0.0
  - Microsoft.Extensions.Caching.StackExchangeRedis 9.0.3 -> 10.0.0

The Microsoft.Extensions.* bumps are required because OpenTelemetry's
transitive chain (Microsoft.Extensions.Logging.Configuration 10.0.0)
demands Configuration.Binder >= 10.0.0 — staying on 9.0.0 produces
NU1605 package-downgrade errors (warning-as-error).

Service.csproj (Microsoft.NET.Sdk.Web) — drop now-redundant
PackageReferences (NU1510, warning-as-error):
  - Microsoft.Extensions.Configuration.Binder  (in shared framework)
  - Microsoft.Extensions.Configuration.Json    (in shared framework)

Azure DevOps pipelines (9 occurrences across 8 files):
  - UseDotNet@2 version: 8.0.x -> 10.0.x

Container base images (Dockerfile):
  - mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0   -> 10.0-azurelinux3.0
  - mcr.microsoft.com/dotnet/aspnet:8.0-cbl-mariner2.0 -> 10.0-azurelinux3.0
  (cbl-mariner2.0 tag does not exist for .NET 9+; Azure Linux 3.0 is
   Microsoft's documented successor.)

Aspire AppHost (src/Aspire.AppHost/AppHost.cs):
  - WithArgs("-f", "net8.0") -> WithArgs("-f", "net10.0")  (mssql + pg)

Build/publish scripts:
  - scripts/publish.ps1:               $dotnetTargetFrameworks net8.0 -> net10.0
  - scripts/create-manifest-file.ps1:  $dotnetTargetFrameworks + hashtable
                                       keys net8.0_{rid} -> net10.0_{rid}
                                       (TODO marker: release-engineering to
                                       confirm download URLs/hashes resolve)

License file rename:
  - external_licenses/Microsoft.Data.SqlClient.SNI.5.2.0.License.txt
    -> external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt
  - scripts/notice-generation.ps1: path updated to match
  - TODO marker at top of license file: contents still 5.2.0 text;
    release-engineering to refresh from upstream before merge.

SUPPRESSED ASPDEPR008 (warning-as-error) — DELIBERATE
=====================================================

ASP.NET Core 10 deprecates IWebHostBuilder / IWebHost in favor of
WebApplicationBuilder / IHost. Two locations in this repo still consume
the obsolete types and would block compilation under the repo's
TreatWarningsAsErrors=true setting:

  - src/Service/Program.cs (2 sites): test-only helpers
    CreateWebHostBuilder + CreateWebHostFromInMemoryUpdatableConfBuilder
    are consumed by the existing TestServer fixture which takes
    IWebHostBuilder.
  - src/Service.Tests/Configuration/ConfigurationTests.cs (3 sites):
    the consumer of those helpers.

Migrating from WebHost to HostBuilder/WebApplicationBuilder is a
behavior-affecting refactor and explicitly OUT OF SCOPE for this
no-behavior-change prerequisite PR. Suppression is added at the
project level (NoWarn=ASPDEPR008 on Service.csproj + Service.Tests.csproj)
with an inline TODO comment pointing at this branch and a follow-up
issue link placeholder.

VALIDATION
==========

dotnet --version          : 10.0.301
dotnet restore --nologo   : 11/11 projects restored (8.05s avg)
dotnet build  -c Debug    : 0 warnings, 0 errors, 10.32s

Multi-engine test categories (MsSql, PostgreSql, MySql, CosmosDb_NoSql,
DwSql) were NOT run locally; they MUST run green on the Azure DevOps
multi-engine matrix before this PR merges. That matrix is the gate.

NEXT STEPS BEFORE MERGE
=======================

1. Release-engineering: refresh
   external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt
   from upstream for the SNI 6.0.0 version (currently still 5.2.0 text
   with a TODO marker at top).
2. Release-engineering: confirm
   scripts/create-manifest-file.ps1 net10.0_{linux,win,osx}-x64 download
   URLs and SHA hashes resolve once the .NET 10 publish cycle runs.
3. Multi-engine CI matrix runs green (MsSql, PostgreSql, MySql,
   CosmosDb_NoSql, DwSql) — that is the merge gate.
4. File follow-up issue for ASPDEPR008 migration (WebHost ->
   WebApplicationBuilder / IHost) so the NoWarn suppressions can be
   removed in a future behavior-changing PR.

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.

Pull request overview

This PR upgrades Data API Builder’s build/runtime baseline to .NET 10 (SDK pin + project TFMs) and bumps Microsoft.Data.SqlClient to 6.x as a prerequisite for upcoming SQL JSON / vector datatype support that depends on SqlDbType.Json being present in the BCL.

Changes:

  • Pin SDK to .NET 10.0.301 and retarget all src/** projects from net8.0 to net10.0.
  • Update central package versions (notably Microsoft.Data.SqlClient 6.0.2 and required Microsoft.Extensions.* 10.0.0) and remove now-redundant Service package refs.
  • Update pipelines/scripts/container images to build with .NET 10 and adjust ancillary release/notice assets (including SNI license file rename).

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
global.json Pins repo SDK to 10.0.301.
src/Service/Azure.DataApiBuilder.Service.csproj Retarget to net10.0, add ASPDEPR008 suppression, remove redundant config package refs.
src/Service.Tests/Azure.DataApiBuilder.Service.Tests.csproj Retarget tests to net10.0, add ASPDEPR008 suppression.
src/Core/Azure.DataApiBuilder.Core.csproj Retarget core library to net10.0.
src/Config/Azure.DataApiBuilder.Config.csproj Retarget config library to net10.0.
src/Auth/Azure.DataApiBuilder.Auth.csproj Retarget auth library to net10.0.
src/Cli/Cli.csproj Retarget CLI to net10.0.
src/Cli.Tests/Cli.Tests.csproj Retarget CLI tests to net10.0.
src/Product/Azure.DataApiBuilder.Product.csproj Retarget product project to net10.0.
src/Service.GraphQLBuilder/Azure.DataApiBuilder.Service.GraphQLBuilder.csproj Retarget GraphQL builder to net10.0.
src/Azure.DataApiBuilder.Mcp/Azure.DataApiBuilder.Mcp.csproj Retarget MCP project to net10.0.
src/Aspire.AppHost/Aspire.AppHost.csproj Retarget Aspire AppHost to net10.0.
src/Aspire.AppHost/AppHost.cs Update AppHost args from net8.0 to net10.0.
src/Directory.Packages.props Bump SqlClient + required Microsoft.Extensions.* packages to 10/6.x.
Dockerfile Move SDK/runtime base images to .NET 10 Azure Linux tags.
scripts/publish.ps1 Update publish framework strings to net10.0.
scripts/create-manifest-file.ps1 Update manifest framework keys to net10.0_*.
scripts/notice-generation.ps1 Update SNI license file path for notice generation.
external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt Renamed SNI license file for SqlClient 6.x (currently includes a TODO marker).
.pipelines/templates/static-tools.yml UseDotNet version updated to 10.0.x.
.pipelines/templates/mssql-test-steps.yml UseDotNet version updated to 10.0.x.
.pipelines/templates/build-pipelines.yml UseDotNet version updated to 10.0.x.
.pipelines/pg-pipelines.yml UseDotNet version updated to 10.0.x.
.pipelines/mysql-pipelines.yml UseDotNet version updated to 10.0.x.
.pipelines/mssql-pipelines.yml UseDotNet version updated to 10.0.x.
.pipelines/dwsql-pipelines.yml UseDotNet version updated to 10.0.x (linux + windows jobs).
.pipelines/cosmos-pipelines.yml UseDotNet version updated to 10.0.x.
Comments suppressed due to low confidence (1)

external_licenses/Microsoft.Data.SqlClient.SNI.6.0.0.License.txt:5

  • This license file still contains a TODO marker stating the body is for SNI 5.2.0, not the updated 6.0.0 version. Shipping with an intentionally stale license text (and an in-file TODO note) is a compliance risk; the file should be refreshed from the upstream SNI 6.0.0 license source before merge.

@@ -24,7 +24,7 @@ jobs:
displayName: Setup .NET SDK v8.0.x
@@ -34,7 +34,7 @@ steps:
displayName: Setup .NET SDK v8.0.x
@@ -57,7 +57,7 @@ steps:
displayName: Setup .NET SDK v8.0.x
@@ -44,7 +44,7 @@ jobs:
displayName: Setup .NET SDK v8.0.x
@@ -49,7 +49,7 @@ jobs:
displayName: Setup .NET SDK v8.0.x
@@ -179,7 +179,7 @@ jobs:
displayName: Setup .NET SDK v8.0.x
@@ -57,7 +57,7 @@ steps:
displayName: Setup .NET SDK v8.0.x
Comment on lines +15 to +17
6.x prerequisite PR stays behavior-preserving. TODO(prereq-PR
Usr/sogh/upgrade-net10-sqlclient6): file a follow-up issue. -->
<NoWarn>NU1603;ASPDEPR008</NoWarn>
Comment on lines +13 to +14
TODO(prereq-PR Usr/sogh/upgrade-net10-sqlclient6): file a follow-up issue. -->
<NoWarn>NU1603;ASPDEPR008</NoWarn>
Comment on lines +24 to +27
# TODO(prereq-PR Usr/sogh/upgrade-net10-sqlclient6): String-only swap of
# net8.0 -> net10.0. Release-engineering: please confirm the
# net10.0_{linux,win,osx}-x64 download URLs and SHA hashes referenced
# downstream still resolve after the .NET 10 publish cycle runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Upgrade .Net and SQLClient to support JSON and Vector data types

2 participants