Skip to content

Conversation

@64J0
Copy link
Member

@64J0 64J0 commented Dec 6, 2025

Description

With this PR, I'm adding .NET 10 to the list of test TFMs and updating CI to install only .NET 10.

How to test

Check that CI is working fine.

Copy link
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 .NET 10 to the list of target framework monikers (TFMs) for the Giraffe project. The changes adapt the codebase to handle breaking changes in .NET 10's test infrastructure, specifically the deprecation of TestServer constructor patterns in favor of using HostBuilder with ConfigureWebHost.

  • Updates target frameworks to include net10.0 across project files
  • Modifies test infrastructure to use HostBuilder pattern for .NET 10+ via conditional compilation
  • Updates CI/CD workflows to build and test against .NET 10.x SDK

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Giraffe/Giraffe.fsproj Adds net10.0 to the target frameworks list
tests/Giraffe.Tests/Giraffe.Tests.fsproj Adds net10.0 target framework and Microsoft.AspNetCore.TestHost 10.0.* package reference
tests/Giraffe.Tests/Helpers.fs Implements .NET 10 compatibility using HostBuilder pattern with conditional compilation, adds Microsoft.Extensions.Hosting import
.github/workflows/build-and-test.yml Adds .NET 10.x SDK to build matrix and updates analyzer job to use .NET 10.x
.github/workflows/publish.yml Adds .NET 10.x SDK to both build and deploy job matrices

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

LGTM

7.x
8.x
9.x
10.x
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this matrix make sense? Would just keeping 9.0 and 10.0 not make more sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, I think it could work just keeping 9.0 and 10.0.

I'll send a commit to test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Related commit: 43757ca

Copy link
Member Author

Choose a reason for hiding this comment

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

It was working before because GitHub Actions is currently automatically installing .NET {8, 9}.

Related comment: #702 (comment)

uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.x
dotnet-version: 10.x
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this not pick up the version from the global.json?

Copy link
Member Author

@64J0 64J0 Dec 7, 2025

Choose a reason for hiding this comment

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

This project doesn't have a global.json. Perhaps we could add one in the future.


<!-- Build settings -->
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

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

Life is too short to support all these.
I would go for 9 & 10 only here.

Copy link
Member

Choose a reason for hiding this comment

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

Im unsure why we need to add this version in the first place. Is there an api we’re missing if we dont add it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there an api we’re missing if we dont add it?

No relevant APIs missing for now, AFAIK.

However, I still think it's good to add this version there. Doing so, we grant that the code targeting this version compiles successfully.

Copy link
Member

Choose a reason for hiding this comment

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

Newer versions of dotnet can consume older versions of TFMs.

See demystifyfp/FsToolkit.ErrorHandling#345 (review) for a more detailed example of when adding a TFM is a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

I know. My point is related to potential breaking changes being captured earlier in this codebase.

For example, when I added net10.0 to the TFMs at the tests project, I discovered this: aspnet/Announcements#526. And already added the code to deal with this breaking change.

My rationale was that adding net10.0 to the TFMs at the src/ project would help to identify this kind of problem earlier, or at least grant that the project is able to compile properly using .NET 10.

Perhaps this makes our life easier in the future in a scenario where we really want to update the base .NET version due to missing APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the net10.0 from the src/ project and update the CI to install only .NET 10, since it might be enough to build the older versions.

64J0 and others added 5 commits December 13, 2025 11:51
- Update GitHub Actions configuration
- Update tests due to .NET 10 breaking changes
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@64J0 64J0 changed the title Add .NET 10 to the list of TFMs Add .NET 10 to the list of test TFMs and update CI Dec 13, 2025
7.x
8.x
9.x
dotnet-version: 10.x
Copy link
Member

@TheAngryByrd TheAngryByrd Dec 13, 2025

Choose a reason for hiding this comment

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

I think we should keep the 8.x and 9.x versions explicitly since we're still running tests again 8 and 9 TFMs. While github runners come with them by default, I wouldn't want to rely on them for being in control and removing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, I'll send the patch later today

Copy link
Member Author

Choose a reason for hiding this comment

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

Related commit cae930f

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.

4 participants