Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .NET 9 #1404

Merged
merged 41 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1c2648e
Updated build and integration test scripts to include .NET 9
WhitWaldo Nov 10, 2024
58b12e3
Removed unused matrix values
WhitWaldo Nov 10, 2024
804a9d6
Reverted some .NET 8 requirement
WhitWaldo Nov 10, 2024
9a1b3a3
Updated setup-dotnet to use latest action version + updated script to…
WhitWaldo Nov 10, 2024
1b77c0a
Removed unnecessary secondary build step
WhitWaldo Nov 10, 2024
dc8d091
Updating TFM moniker
WhitWaldo Nov 10, 2024
0bc6170
Added test to install VStest
WhitWaldo Nov 10, 2024
a725d8c
Rolling back use of tool as it doesn't independently exist outside of…
WhitWaldo Nov 10, 2024
df627f9
Added .NET 9 to build targets
WhitWaldo Nov 10, 2024
70916bc
Added .NET 9 to target frameworks across solution
WhitWaldo Nov 10, 2024
378ac9f
I understand the reason for the required install step now - adding it…
WhitWaldo Nov 10, 2024
1029619
Placing install steps before build
WhitWaldo Nov 10, 2024
ec3e953
Updating global.json
WhitWaldo Nov 10, 2024
763dc75
Disabled analyzer errors in unit tests
WhitWaldo Nov 10, 2024
37219db
Added .NET 9 to test
WhitWaldo Nov 10, 2024
9b7f68c
Changed from #pragma error to #pragma warning
WhitWaldo Nov 10, 2024
ed01370
Fixed unit tests to resolve analyzer warning
WhitWaldo Nov 10, 2024
b293f31
Updated integration test to always include .NET 8 and .NET 9 installs
WhitWaldo Nov 10, 2024
2ac5207
Falling back to add separate .NET 9 support
WhitWaldo Nov 10, 2024
056c7d4
Updated referenced projects to target appropriate frameworks
WhitWaldo Nov 10, 2024
9a21e82
Added all target frameworks back to Dapr.Commono
WhitWaldo Nov 10, 2024
677b982
Added warnings to fix nullability analyzer warnings when targeting .N…
WhitWaldo Nov 10, 2024
6bc4794
Merge branch 'master' into net-9
WhitWaldo Nov 20, 2024
df39909
Merge branch 'master' into net-9
WhitWaldo Nov 26, 2024
1be87d6
Updated build step to use .NET 9 instead
WhitWaldo Nov 26, 2024
a7e15da
Fixed cloud event middleware tests - the ApplicationBuilder requires …
WhitWaldo Nov 26, 2024
e32c9a6
Including target for .NET 6, 7, 8 and 9
WhitWaldo Nov 26, 2024
0189ffc
Trialing fix to E2E integration test - excluding use of AppWebApplica…
WhitWaldo Nov 26, 2024
3635f5e
Reverting as it breaks the other .NET versions
WhitWaldo Nov 26, 2024
9506c0d
Potentially fixed unit tests in .NET 9
WhitWaldo Nov 30, 2024
9b33d36
Removed extra line from build definition
WhitWaldo Nov 30, 2024
aecf3d4
Updated documentation to reflect .NET 9 and a note highlighting that …
WhitWaldo Nov 30, 2024
25a22e7
Removed unintentionally added file to commit
WhitWaldo Nov 30, 2024
38820c4
Added .NET 9 to E2E test setup
WhitWaldo Nov 30, 2024
55ecd2c
Merge branch 'master' into net-9
WhitWaldo Nov 30, 2024
31bdbef
Fixed typo
WhitWaldo Dec 3, 2024
8860de6
Removed RC version from .NET 9 build
WhitWaldo Dec 3, 2024
cba669e
Apparently the solution file got a minor change
WhitWaldo Dec 3, 2024
fe7daf8
Removed unnecessary null checks
WhitWaldo Dec 3, 2024
33f972a
Whoops - didn't mean to commit that project to the solution
WhitWaldo Dec 3, 2024
e59e34d
Merge branch 'master' into net-9
WhitWaldo Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
dotnet-version: ['6.0', '7.0', '8.0']
dotnet-version: ['6.0', '7.0', '8.0', '9.0']
include:
- dotnet-version: '6.0'
display-name: '.NET 6.0'
Expand All @@ -37,6 +37,11 @@ jobs:
framework: 'net8'
prefix: 'net8'
install-version: '8.0.x'
- dotnet-version: '9.0'
display-name: '.NET 9.0'
framework: 'net9'
prefix: 'net9'
install-version: '9.0.x'
env:
NUPKG_OUTDIR: bin/Release/nugets
GOVER: 1.20.3
Expand Down Expand Up @@ -103,14 +108,22 @@ jobs:
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup ${{ matrix.display-name }}
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.install-version }}
- name: Setup .NET 8.0 # net8 is always required.
uses: actions/setup-dotnet@v1
dotnet-quality: 'ga' # Prefer a GA release, but use the RC if not available
- name: Setup .NET 8 (required)
uses: actions/setup-dotnet@v3
if: ${{ matrix.install-version != '8.0.x' }}
with:
dotnet-version: 8.0.x
dotnet-version: '8.0.x'
dotnet-quality: 'ga'
- name: Setup .NET 9 (required)
uses: actions/setup-dotnet@v3
if: ${{ matrix.install-version != '9.0.x' }}
with:
dotnet-version: '9.0.x'
dotnet-quality: 'ga'
- name: Build
# disable deterministic builds, just for test run. Deterministic builds break coverage for some reason
run: dotnet build --configuration release /p:GITHUB_ACTIONS=false
Expand Down
31 changes: 21 additions & 10 deletions .github/workflows/sdk_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ jobs:
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
dotnet-quality: 'ga'
- name: Build
run: dotnet build --configuration release
- name: Generate Packages
Expand All @@ -43,39 +44,49 @@ jobs:
strategy:
fail-fast: false
matrix:
dotnet-version: ['6.0', '7.0', '8.0']
dotnet-version: ['6.0', '7.0', '8.0', '9.0']
include:
- dotnet-version: '6.0'
install-3: false
display-name: '.NET 6.0'
framework: 'net6'
prefix: 'net6'
install-version: '6.0.x'
- dotnet-version: '7.0'
install-3: false
display-name: '.NET 7.0'
framework: 'net7'
prefix: 'net7'
install-version: '7.0.x'
- dotnet-version: '8.0'
install-3: false
display-name: '.NET 8.0'
framework: 'net8'
prefix: 'net8'
install-version: '8.0.x'
- dotnet-version: '9.0'
display-name: '.NET 9.0'
framework: 'net9'
prefix: 'net9'
install-version: '9.0.x'
steps:
- uses: actions/checkout@v1
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup ${{ matrix.display-name }}
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.install-version }}
- name: Setup .NET 8.0 # net8 is always required.
uses: actions/setup-dotnet@v1
dotnet-quality: 'ga' # Prefer a GA release, but use the RC if not available
- name: Setup .NET 8 (required)
uses: actions/setup-dotnet@v3
if: ${{ matrix.install-version != '8.0.x' }}
with:
dotnet-version: 8.0.x
dotnet-version: '8.0.x'
dotnet-quality: 'ga'
- name: Setup .NET 9 (required)
uses: actions/setup-dotnet@v3
if: ${{ matrix.install-version != '9.0.x' }}
with:
dotnet-version: '9.0.x'
dotnet-quality: 'ga'
- name: Build
# disable deterministic builds, just for test run. Deterministic builds break coverage for some reason
run: dotnet build --configuration release /p:GITHUB_ACTIONS=false
Expand Down
4 changes: 2 additions & 2 deletions all.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# 17
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapr.Actors", "src\Dapr.Actors\Dapr.Actors.csproj", "{C2DB4B64-B7C3-4FED-8753-C040F677C69A}"
Expand Down Expand Up @@ -366,7 +366,7 @@ Global
{290D1278-F613-4DF3-9DF5-F37E38CDC363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{290D1278-F613-4DF3-9DF5-F37E38CDC363}.Debug|Any CPU.Build.0 = Debug|Any CPU
{290D1278-F613-4DF3-9DF5-F37E38CDC363}.Release|Any CPU.ActiveCfg = Release|Any CPU
{290D1278-F613-4DF3-9DF5-F37E38CDC363}.Release|Any CPU.Build.0 = Release|Any CP
{290D1278-F613-4DF3-9DF5-F37E38CDC363}.Release|Any CPU.Build.0 = Release|Any CPU
{C8BB6A85-A7EA-40C0-893D-F36F317829B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8BB6A85-A7EA-40C0-893D-F36F317829B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8BB6A85-A7EA-40C0-893D-F36F317829B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
10 changes: 9 additions & 1 deletion daprdocs/content/en/dotnet-sdk-docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ Dapr offers a variety of packages to help with the development of .NET applicati

- [Dapr CLI]({{< ref install-dapr-cli.md >}}) installed
- Initialized [Dapr environment]({{< ref install-dapr-selfhost.md >}})
- [.NET 6](https://dotnet.microsoft.com/download) or [.NET 8+](https://dotnet.microsoft.com/download) installed
- [.NET 6](https://dotnet.microsoft.com/download), [.NET 8](https://dotnet.microsoft.com/download) or [.NET 9](https://dotnet.microsoft.com/download) installed

{{% alert title="Note" color="primary" %}}

Note that while .NET 6 is generally supported as the minimum .NET requirement across the Dapr .NET SDK packages
and .NET 7 is the minimally supported version of .NET by Dapr.Workflows in Dapr v1.15, only .NET 8 and .NET 9 will
continue to be supported by Dapr in v1.16 and later.

{{% /alert %}}

## Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ This project contains the implementation of the actor client which calls MyActor

- [Dapr CLI]({{< ref install-dapr-cli.md >}}) installed.
- Initialized [Dapr environment]({{< ref install-dapr-selfhost.md >}}).
- [.NET 6+](https://dotnet.microsoft.com/download) installed. Dapr .NET SDK uses [ASP.NET Core](https://docs.microsoft.com/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-6.0).
- [.NET 6](https://dotnet.microsoft.com/download), [.NET 8](https://dotnet.microsoft.com/download) or [.NET 9](https://dotnet.microsoft.com/download) installed

{{% alert title="Note" color="primary" %}}

Note that while .NET 6 is generally supported as the minimum .NET requirement across the Dapr .NET SDK packages
and .NET 7 is the minimally supported version of .NET by Dapr.Workflows in Dapr v1.15, only .NET 8 and .NET 9 will
continue to be supported by Dapr in v1.16 and later.

{{% /alert %}}

## Step 0: Prepare

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ In the .NET example project:
- The main [`Program.cs`](https://github.com/dapr/dotnet-sdk/tree/master/examples/Jobs/JobsSample/Program.cs) file comprises the entirety of this demonstration.

## Prerequisites
- [.NET 6+](https://dotnet.microsoft.com/download) installed
- [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/)
- [Initialized Dapr environment](https://docs.dapr.io/getting-started/install-dapr-selfhost)
- [Dapr Jobs .NET SDK](https://github.com/dapr/dotnet-sdk)
- [.NET 6](https://dotnet.microsoft.com/download), [.NET 8](https://dotnet.microsoft.com/download) or [.NET 9](https://dotnet.microsoft.com/download) installed

{{% alert title="Note" color="primary" %}}

Note that while .NET 6 is generally supported as the minimum .NET requirement across the Dapr .NET SDK packages
and .NET 7 is the minimally supported version of .NET by Dapr.Workflows in Dapr v1.15, only .NET 8 and .NET 9 will
continue to be supported by Dapr in v1.16 and later.

{{% /alert %}}

## Set up the environment
Clone the [.NET SDK repo](https://github.com/dapr/dotnet-sdk).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ In the .NET example project:

## Prerequisites

- [.NET 6+](https://dotnet.microsoft.com/download) installed
- [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/)
- [Initialized Dapr environment](https://docs.dapr.io/getting-started/install-dapr-selfhost/)
- [Dapr .NET SDK](https://github.com/dapr/dotnet-sdk/)
- [.NET 7](https://dotnet.microsoft.com/download), [.NET 8](https://dotnet.microsoft.com/download) or [.NET 9](https://dotnet.microsoft.com/download) installed

{{% alert title="Note" color="primary" %}}

Note that while .NET 6 is generally supported as the minimum .NET requirement across the Dapr .NET SDK packages
and .NET 7 is the minimally supported version of .NET by Dapr.Workflows in Dapr v1.15, only .NET 8 and .NET 9 will
continue to be supported by Dapr in v1.16 and later.

{{% /alert %}}

## Set up the environment

Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_comment": "This policy allows the 8.0.100 SDK or patches in that family.",
"sdk": {
"version": "8.0.100",
"rollForward": "minor"
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion src/Dapr.Common/Dapr.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net7;net8</TargetFrameworks> <!-- Supports .NET 7 for Dapr.Workflow -->
<TargetFrameworks>net6;net7;net8;net9</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Dapr.Jobs/Dapr.Jobs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net8</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>Dapr.Jobs</PackageId>
Expand Down
4 changes: 2 additions & 2 deletions src/Dapr.Jobs/Models/DaprJobSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public static DaprJobSchedule FromCronExpression(CronExpressionBuilder builder)
/// <returns></returns>
public static DaprJobSchedule FromDateTime(DateTimeOffset scheduledTime)
{
ArgumentNullException.ThrowIfNull(scheduledTime, nameof(scheduledTime));
return new DaprJobSchedule(scheduledTime.ToString("O"));
}

Expand All @@ -77,7 +76,9 @@ public static DaprJobSchedule FromDateTime(DateTimeOffset scheduledTime)
/// <param name="expression">The systemd Cron-like expression indicating when the job should be triggered.</param>
public static DaprJobSchedule FromExpression(string expression)
{
#if NET6_0
ArgumentNullException.ThrowIfNull(expression, nameof(expression));
#endif
return new DaprJobSchedule(expression);
}

Expand All @@ -87,7 +88,6 @@ public static DaprJobSchedule FromExpression(string expression)
/// <param name="duration">The duration interval.</param>
public static DaprJobSchedule FromDuration(TimeSpan duration)
{
ArgumentNullException.ThrowIfNull(duration, nameof(duration));
return new DaprJobSchedule(duration.ToDurationString());
}

Expand Down
1 change: 1 addition & 0 deletions src/Dapr.Protos/Dapr.Protos.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net7;net8;net9</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>This package contains the reference protos used by develop services using Dapr.</Description>
Expand Down
1 change: 1 addition & 0 deletions src/Dapr.Workflow/Dapr.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- NuGet configuration -->
<PropertyGroup>
<!-- NOTE: Workflows targeted .NET 7 (whereas other packages did not, so we must continue until .NET 7 EOL). -->
<TargetFrameworks>net6;net7;net8;net9</TargetFrameworks>
<Nullable>enable</Nullable>
<PackageId>Dapr.Workflow</PackageId>
<Title>Dapr Workflow Authoring SDK</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\properties\dapr_nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6;net8</TargetFrameworks>
<TargetFrameworks>net6;net8;net9</TargetFrameworks>
<OutputPath>$(RepoRoot)bin\$(Configuration)\prod\$(MSBuildProjectName)\</OutputPath>

<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public Test()
7;
#elif NET8_0
8;
#elif NET9_0
9;
#endif

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public async Task CanSendBinaryCloudEvent_WithContentType()
using (var factory = new AppWebApplicationFactory())
{
var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });

var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/register-user")
{
Content = new StringContent(
Expand All @@ -158,10 +158,10 @@ public async Task CanSendBinaryCloudEvent_WithContentType()
Encoding.UTF8)
};
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();

var userInfo = await JsonSerializer.DeserializeAsync<UserInfo>(await response.Content.ReadAsStreamAsync(), this.options);
userInfo.Name.Should().Be("jimmy");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,36 @@
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<!-- <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />-->
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />


</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9'">
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" VersionOverride="9.0.0" />
<PackageReference Update="Microsoft.AspNetCore.TestHost" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Configuration" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Configuration.Abstractions" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.DependencyInjection" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Hosting" VersionOverride="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" VersionOverride="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" VersionOverride="9.0.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.AspNetCore\Dapr.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Dapr.Protos\Dapr.Protos.csproj" />
Expand Down
Loading
Loading