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

.NET 8 Support #1188

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['6.0', '7.0']
dotnet-version: ['6.0', '7.0', '8.0']
include:
- dotnet-version: '6.0'
display-name: '.NET 6.0'
Expand All @@ -31,6 +31,11 @@ jobs:
framework: 'net7'
prefix: 'net7'
install-version: '7.0.x'
- dotnet-version: '8.0'
display-name: '.NET 8.0'
framework: 'net8'
prefix: 'net8'
install-version: '8.0.x'
env:
NUPKG_OUTDIR: bin/Release/nugets
GOVER: 1.20.3
Expand Down Expand Up @@ -101,11 +106,11 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.install-version }}
- name: Setup .NET 7.0 # net7 is always required.
- name: Setup .NET 8.0 # net8 is always required.
uses: actions/setup-dotnet@v1
if: ${{ matrix.install-version != '7.0.x' }}
if: ${{ matrix.install-version != '8.0.x' }}
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- 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
16 changes: 11 additions & 5 deletions .github/workflows/sdk_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build
run: dotnet build --configuration release
- name: Generate Packages
Expand All @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['6.0', '7.0']
dotnet-version: ['6.0', '7.0', '8.0']
include:
- dotnet-version: '6.0'
install-3: false
Expand All @@ -56,6 +56,12 @@ jobs:
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'
steps:
- uses: actions/checkout@v1
- name: Parse release version
Expand All @@ -64,11 +70,11 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.install-version }}
- name: Setup .NET 7.0 # net7 is always required.
- name: Setup .NET 8.0 # net8 is always required.
uses: actions/setup-dotnet@v1
if: ${{ matrix.install-version != '7.0.x' }}
if: ${{ matrix.install-version != '8.0.x' }}
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- 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
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
if (header != string.Empty)
{
// exception case
context.Response.Headers.Add(Constants.ErrorResponseHeaderName, header); // add error header
context.Response.Headers[Constants.ErrorResponseHeaderName] = header; // add error header

Check warning on line 112 in src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs#L112

Added line #L112 was not covered by tests
}

await context.Response.Body.WriteAsync(body, 0, body.Length); // add response message body
Expand All @@ -118,7 +118,7 @@
{
var (header, body) = CreateExceptionResponseMessage(ex);

context.Response.Headers.Add(Constants.ErrorResponseHeaderName, header);
context.Response.Headers[Constants.ErrorResponseHeaderName] = header;

Check warning on line 121 in src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs#L121

Added line #L121 was not covered by tests
await context.Response.Body.WriteAsync(body, 0, body.Length);
}
finally
Expand Down
3 changes: 0 additions & 3 deletions src/Dapr.Actors.AspNetCore/Dapr.Actors.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<!--
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.Actors/Dapr.Actors.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<!-- Additional Nuget package properties. -->
<PropertyGroup>
<Description>This package contains the reference assemblies for developing Actor services using Dapr.</Description>
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.AspNetCore/Dapr.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<!-- Additional Nuget package properties. -->
<PropertyGroup>
<Description>This package contains the reference assemblies for developing services using Dapr and AspNetCore.</Description>
Expand Down
9 changes: 9 additions & 0 deletions src/Dapr.AspNetCore/DaprAuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ internal class DaprAuthenticationHandler : AuthenticationHandler<DaprAuthenticat
{
const string DaprApiToken = "Dapr-Api-Token";

#if NET8_0_OR_GREATER
public DaprAuthenticationHandler(
IOptionsMonitor<DaprAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder) : base(options, logger, encoder)
{
}
#else
public DaprAuthenticationHandler(
IOptionsMonitor<DaprAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock) : base(options, logger, encoder, clock)
{
}
#endif

protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.Client/Dapr.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Shared\ArgumentVerifier.cs" />
<Compile Include="..\Shared\DaprDefaults.cs" />
Expand Down
6 changes: 6 additions & 0 deletions src/Dapr.Client/DaprApiException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public DaprApiException(string message, Exception inner, string errorCode, bool
/// </summary>
/// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo" /> object that contains serialized object data of the exception being thrown.</param>
/// <param name="context">The <see cref="System.Runtime.Serialization.StreamingContext" /> object that contains contextual information about the source or destination. The context parameter is reserved for future use and can be null.</param>
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to the serialization ctor
#endif
protected DaprApiException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand All @@ -115,6 +118,9 @@ protected DaprApiException(SerializationInfo info, StreamingContext context)
public bool IsTransient { get; } = false;

/// <inheritdoc />
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to GetObjectData
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
3 changes: 3 additions & 0 deletions src/Dapr.Client/DaprException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public DaprException(string message, Exception innerException)
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> object that contains serialized object data of the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> object that contains contextual information about the source or destination. The context parameter is reserved for future use and can be null.</param>
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to GetObjectData
#endif
protected DaprException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/Dapr.Workflow/Dapr.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

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

<PropertyGroup>
<TargetFrameworks>net6;net8</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
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.Actors.AspNetCore\Dapr.Actors.AspNetCore.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
<BaseNamespace>Dapr.Actors.AspNetCore</BaseNamespace>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion test/Dapr.Actors.Test/Dapr.Actors.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
<RootNamespace>Dapr.Actors</RootNamespace>
<DefineConstants>$(DefineConstants);ACTORS</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.AspNetCore\Dapr.AspNetCore.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
Expand Down
3 changes: 0 additions & 3 deletions test/Dapr.AspNetCore.Test/Dapr.AspNetCore.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
Expand Down
3 changes: 0 additions & 3 deletions test/Dapr.Client.Test/Dapr.Client.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
Expand Down
4 changes: 0 additions & 4 deletions test/Dapr.E2E.Test.Actors/Dapr.E2E.Test.Actors.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.Actors\Dapr.Actors.csproj" />
</ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions test/Dapr.E2E.Test.App.Grpc/Dapr.E2E.Test.App.Grpc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.39.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition=" '$(RunConfiguration)' == 'Dapr.E2E.Test.App.ReentrantActor' " />
<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.AspNetCore\Dapr.AspNetCore.csproj" />
Expand Down
4 changes: 0 additions & 4 deletions test/Dapr.E2E.Test.App/Dapr.E2E.Test.App.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dapr.AspNetCore\Dapr.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Dapr.Actors.AspNetCore\Dapr.Actors.AspNetCore.csproj" />
Expand Down
3 changes: 0 additions & 3 deletions test/Dapr.E2E.Test/Dapr.E2E.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Google.Protobuf" Version="3.21.12" />
Expand Down
16 changes: 7 additions & 9 deletions test/Dapr.E2E.Test/DaprTestApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,14 @@ public void Stop()
private static string GetTargetFrameworkName()
{
var targetFrameworkName = ((TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(TargetFrameworkAttribute), false).FirstOrDefault()).FrameworkName;
string frameworkMoniker;
if (targetFrameworkName == ".NETCoreApp,Version=v6.0")
{
frameworkMoniker = "net6";
}
else

return targetFrameworkName switch
{
frameworkMoniker = "net7";
}
return frameworkMoniker;
".NETCoreApp,Version=v6.0" => "net6",
".NETCoreApp,Version=v7.0" => "net7",
".NETCoreApp,Version=v8.0" => "net8",
_ => throw new InvalidOperationException($"Unsupported target framework: {targetFrameworkName}")
};
}

private static (int, int, int, int) GetFreePorts()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
Expand Down
2 changes: 2 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<Import Project="$(MSBuildThisFileDirectory)..\properties\dapr_managed_netcore.props" />

<PropertyGroup>
<TargetFrameworks>net6;net7;net8</TargetFrameworks>

<!-- Set Output Path for tests-->
<OutputPath>$(RepoRoot)bin\$(Configuration)\test\$(MSBuildProjectName)\</OutputPath>

Expand Down
Loading