Skip to content

Prepare dependencies for .NET 10 (net8-safe subset) - #2095

Draft
NickJosevski wants to merge 6 commits into
nj/deps-cve-test-toolingfrom
nj/net10-prep-deps-v2
Draft

Prepare dependencies for .NET 10 (net8-safe subset)#2095
NickJosevski wants to merge 6 commits into
nj/deps-cve-test-toolingfrom
nj/net10-prep-deps-v2

Conversation

@NickJosevski

@NickJosevski NickJosevski commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2094. Base is nj/deps-cve-test-tooling. Review and merge #2094 first. This PR retargets to main after #2094 lands.

Background

Calamari has to reach .NET 10 before .NET 8 support ends on 10 November 2026.

Every risky dependency bump is done while Calamari still targets net8. A green build on net8 proves each bump in isolation. The target framework flip then happens on a dependency graph that is already ready.

The net8 migration in #1528 landed dependency churn, build changes and the framework flip together. Attribution became impossible. Roughly 40 commits of un-attributable fixes followed.

Results

Extracts the net8-safe dependency work from #2091.

Commit What
Remove framework-provided package references Drops packages the framework now supplies
Upgrade Autofac 4.8.0 to 9.3.1 Five majors in one step. No code changes needed
Align remaining dependency versions System.Linq.Async to 7.0.1. Serilog spread collapsed. Microsoft.Extensions.* to 10.0.10
Let dotnet-script roll forward to a newer .NET runtime Sets DOTNET_ROLL_FORWARD=Major on the dotnet-script invocation
Align Serilog versions with Microsoft.Extensions.Logging 10.0.10 Serilog.Extensions.Logging to 10.0.0. Serilog to 4.4.0

The sequencing paid off on Autofac. Five majors from 2018 to current produced zero new warnings and no code changes. ContainerBuilder.Update() is the headline Autofac 5 removal and was never used here.

The dotnet-script commit fixes a live customer bug

Worth calling out because the fix is not really about .NET 10.

Bundled dotnet-script 1.6.0 targets Microsoft.NETCore.App 8.0.0. Framework-dependent apps do not roll forward across a major version by default. A customer whose target has only .NET 10 installed cannot run C# script steps at all. That failure exists today on net8.

Calamari itself is unaffected. Calamari ships self-contained. The failure is in the separate dotnet-script process.

Reducing risk

  • Clean rebuild of source/Calamari.sln on net8.0 at 165 warnings and 0 errors
  • This branch is byte-identical to the original nj/net10-prep-deps apart from main's advance. The split into Upgrade test dependencies carrying known vulnerabilities #2094 and this PR lost nothing
  • DotnetScriptFixture and the WireMock-backed fixtures pass 19 of 19
  • DI, container, module and CommandLocator tests pass 180 of 183. The 3 failures need pwsh. pwsh is not installed on the dev machine. 52 of 64 tests in that suite fail identically on main

How to review this PR

General quality.

⚠️ Does this change require a corresponding Server Change?
⚠️ If so - please add a "Requires Server Change" label to this PR!

@APErebus

APErebus commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This is the opposite of the net8 migration (#1528), which landed dependency, build-system and TFM churn together and produced ~40 commits of un-attributable fixes. The payoff was immediate: Autofac 4.8.0 → 9.3.1 — five majors, 2018 to current — was a non-event. Zero new warnings, all DI tests green. ContainerBuilder.Update(), the headline Autofac 5 removal, was never used here.

Appreciate the shade 🤖

/// whatever newer runtime is present, so C# script steps don't additionally require the exact
/// runtime dotnet-script was built against.
/// </summary>
static Dictionary<string, string> WithDotnetRollForward(Dictionary<string, string>? environmentVars)

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.

DotNet script requires the dotnet sdk, not just the dotnet runtime, does this work for that?

<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="Autofac" Version="4.8.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="Autofac" Version="9.3.1" />

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.

this seems like a huge bump... Probably need some integration testing to make sure it's all on the up and up

@NickJosevski
NickJosevski marked this pull request as draft August 4, 2026 06:55

@zentron zentron 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.

We need to be careful with this upgrade and confirm any breaking changes that will impact users utilizing dotnet-script.

Unfortunately in this new world the customer C# scripts will now run under whatever framework we are running Calamari itself under.

Not marked as Request Changes since this is just more a comment for caution.

NickJosevski and others added 5 commits August 4, 2026 17:49
The .NET 10 SDK raises NU1510 for direct references to packages the framework
already provides. TreatWarningsAsErrors turns NU1510 into a build error. Removing
the references now, on net8, keeps the change isolated from the framework move.

Removed System.ValueTuple, System.ComponentModel.TypeConverter,
System.Diagnostics.Tracing, System.IO.FileSystem,
System.Runtime.InteropServices.RuntimeInformation, and the
Microsoft.NETFramework.ReferenceAssemblies.net462 reference left over from #1669.

System.Threading.AccessControl stays with NoWarn="NU1510". NuGet flags the package
as likely unnecessary. That heuristic assumes a -windows target framework. These
projects target plain net8.0 and need the package for SemaphoreSecurity.

Verified: 164 warnings and 0 errors, identical to baseline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Autofac 4.8.0 dates from 2018 and is five majors behind. Octopus Server already
runs 9.3.1 on net10.

Done while Calamari still targets net8. Autofac 9.3.1 resolves on net8. The DI
upgrade is therefore verified against a known-good baseline instead of being
entangled with the framework change.

Notes for reviewers. ContainerBuilder.Update() is the headline Autofac 5 removal
and was never used here. The .Update call sites in this repo belong to LibGit2Sharp.
The API surface in use is mainstream and unchanged across the version range. The
custom RegisterPrioritisedList<T> extension builds on Meta<T> and WithMetadata.
Both APIs are stable.

Verified: clean rebuild with no new warnings. 26 tests pass covering the custom
registration ordering and flavour resolution.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Continues the dependency work on net8 before the target framework changes.

System.Linq.Async goes to 7.0.1. .NET 10 pulls System.Linq.AsyncEnumerable into the
core libraries. 7.0.1 is the version Octopus Server runs against net10.

Serilog collapses a three-way version spread onto 4.0.2. Microsoft.Extensions.Http
and Microsoft.Extensions.Logging go to 10.0.10.

System.Text.Json and System.Text.Encoding.CodePages are deliberately left alone.
Both become framework-provided on net10. Both are still required on net8. Removing
them now would downgrade System.Text.Json to the in-box 8.x version and lose
security fixes.

Verified: 165 warnings and 0 errors.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Bundled dotnet-script 1.6.0 is a framework-dependent app targeting
Microsoft.NETCore.App 8.0.0. Framework-dependent apps do not roll forward across a
major version by default. On a machine with only .NET 10 installed dotnet-script
fails to launch.

Calamari itself is unaffected. Calamari ships self-contained. The failure is in the
separate dotnet-script process.

Setting DOTNET_ROLL_FORWARD=Major on that invocation lets dotnet-script run on
whatever newer runtime is present. An explicit value already set in the environment
is respected rather than overwritten.

This is a customer-facing fix as much as a CI one. Without the fix a target with
.NET 10 and no .NET 8 runtime cannot run C# script steps at all.

SilentProcessRunner applies EnvironmentVars additively. Passing a dictionary where
one was previously null does not discard the inherited environment.

Not done here: upgrading the bundled dotnet-script. The 2.0.1 release zip Calamari
vendors is still net8 targeted. Only the NuGet package ships a net10 build. The upgrade
also changes the NuGet version dotnet-script bundles. The change invalidates the
premise of UsingIsolatedAssemblyLoadContext.

Verified: 10 DotnetScriptFixture tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Serilog.Extensions.Logging 8.0.0 targets Microsoft.Extensions.Logging 8.0.0. Leaving
it behind after raising Microsoft.Extensions.Logging produces a version spread across
the graph.

Serilog.Extensions.Logging goes to 10.0.0 in Calamari.Testing. Serilog goes to 4.4.0
in Calamari.Testing, Calamari.ConsolidateCalamariPackages and
Calamari.AzureWebApp.NetCoreShim. 4.4.0 is the minimum Serilog.Extensions.Logging
10.0.0 accepts.

Split out of the original combined dependency commit. The vulnerability remediations
in that commit are test-only and landed separately in #2094. These Serilog bumps
touch Calamari.ConsolidateCalamariPackages. That project is packed and shipped.

Verified: clean rebuild of source/Calamari.sln at 165 warnings and 0 errors on net8.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NickJosevski
NickJosevski force-pushed the nj/deps-cve-test-tooling branch from 1b88535 to e47255c Compare August 4, 2026 07:51
@NickJosevski
NickJosevski force-pushed the nj/net10-prep-deps-v2 branch from 1af3547 to 1d13556 Compare August 4, 2026 07:51
No code change. Kicks the TeamCity chain so we have a run to compare
against once the agent starts installing the .NET 10 SDK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants