Skip to content

[PM-28727] Upgrade to .NET 10#7171

Open
dereknance wants to merge 59 commits intomainfrom
pm-28727-dotnet-10
Open

[PM-28727] Upgrade to .NET 10#7171
dereknance wants to merge 59 commits intomainfrom
pm-28727-dotnet-10

Conversation

@dereknance
Copy link
Copy Markdown
Contributor

@dereknance dereknance commented Mar 7, 2026

🎟️ Tracking

PM-28727

📔 Objective

This PR upgrades from .NET 8 to 10.

I left most dependencies at their current versions so they can go through the usual Renovate process.

Notable Changes

  • [PM-33499] Permissive base64 decoder #7207 With .NET 9, Base64.IsValid enforces canonical padding.
  • Update to IHostBuilder style #6843 WebHostBuilder is obsolete
  • X509Certificate2 constructors are obsolete
    • ❗ The now-obsolete constructors allowed X.509, PKCS7, or PKCS12/PFX certs to be passed in. I now attempt to detect PKCS12 or X.509 and call the appropriate loader. I would appreciate a close eye on those changes.
  • NuGetAuditLevel defaults to low with .NET 10, resulting in any dependency with a known vulnerability to block when running dotnet restore. I elected to set it to critical to only block builds for vulns at that severity, and let the existing Renovate process take care of the rest. ❗ I can be convinced to disable this entirely.
  • System.Text.Json 8.0.5 pin removed because package pruning emits NU1510
  • Microsoft.Extensions.Caching.Memory 8.0.1 pin removed as Microsoft.Data.SqlClient requires >=9 and was resulting in a package downgrade
  • Microsoft.AspNetCore.HttpOverrides.IPNetwork and KnownNetworks have been marked as obsolete
  • .NET 10's configuration binder now preserves null values instead of coercing them to empty strings, causing NullReferenceException in .Trim() calls. Added null-conditional operators in property setters in GlobalSettings.cs
  • Upgraded SignalR packages, notably MessagePack from 2.x to 3.x. The wire format appears compatible for our use case
  • New lints required, mostly whitespace

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

Logo
Checkmarx One – Scan Summary & Details07da2400-b526-4103-b3e9-5fa672b2f106


Fixed Issues (1) Great job! The following issues were fixed in this Pull Request
Severity Issue Source File / Package
MEDIUM CSRF src/Api/Vault/Controllers/CiphersController.cs: 287

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The changed tests in this file fix a bug where id (the Org ID) was AssertPropertyEqual'd at the second parameter of GetManyByOrganizationIdWriteAccessAsync which is actually the user ID.

I haven't yet exactly nailed down why this bug presents itself with .NET 10.

a slim debian variant is no longer available

also had to avoid clobbering /etc/environment
@sonarqubecloud
Copy link
Copy Markdown

@dereknance dereknance added the ai-review Request a Claude code review label Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the .NET 8 → .NET 10 framework upgrade across all projects, including target framework bumps, obsolete API migrations (X509Certificate2 constructors → X509CertificateLoader, Microsoft.AspNetCore.HttpOverrides.IPNetworkSystem.Net.IPNetwork), SignalR/MessagePack major version bump, pinned transitive dependency cleanup, NuGetAuditLevel set to critical, and behavioral test fixes for .NET 10 changes (null preservation in configuration binder, stricter Base64.IsValid, new JSON error message formats). The PR description and existing inline threads already address the most notable concerns (X509 loader behavior, EF Core ReadOnlySpan query change, IDataProtector.Unprotect Base64URL requirement, AssertPropertyEqual list-capacity differences, AccessPoliciesControllerTests latent bug). One consistency question remains on the SeederApi Dockerfile.

Code Review Details
  • ❓ : SeederApi Dockerfile app stage still uses aspnet:8.0 while the build stage was bumped to sdk:10.0; every other Dockerfile updates both stages.
    • util/SeederApi/Dockerfile:92

Dependency Changes

Package Change Ecosystem
Microsoft.AspNetCore.SignalR.Protocols.MessagePack 8.0.8 → 10.0.3 (major) NuGet
Microsoft.AspNetCore.SignalR.StackExchangeRedis 8.0.8 → 10.0.3 (major) NuGet
MessagePack 2.5.192 → 3.1.4 (major) NuGet
Microsoft.AspNetCore.Mvc.Testing 8.0.10 → 10.0.3 (major) NuGet
System.Text.Json 8.0.5 → Removed (pin; pruned per NU1510) NuGet
Microsoft.Extensions.Caching.Memory 8.0.1 → Removed (pin; superseded by transitive ≥9) NuGet
Microsoft.AspNetCore.Http (Sso.csproj) 2.2.2 → Removed (legacy transitive pin) NuGet
Microsoft.Build.Sql (global.json) 1.0.0 → 2.1.0 (major) msbuild SDK
.NET SDK (global.json) 8.0.100 → 10.0.103 (major) .NET SDK
TargetFramework (all projects) net8.0 → net10.0 (major) .NET TFM

@dereknance dereknance marked this pull request as ready for review April 22, 2026 23:34
@dereknance dereknance requested review from a team as code owners April 22, 2026 23:34
Comment thread util/SeederApi/Dockerfile

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
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.

🎨 Non-blocking:
Probably just an oversight when these projects got created. Any file that has the TargetFramework updated, should probably be changed to delete the TargetFramework line, so the framework can be picked up via the Directory.BuildProps

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. Maybe that helps reduce the reviewers required for the .NET 12 upgrade 😆

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed! 1e030bf

Comment thread bitwarden_license/src/Scim/Dockerfile Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants