diff --git a/.github/workflows/itests.yml b/.github/workflows/itests.yml index b72e90ef4..71f30dd13 100644 --- a/.github/workflows/itests.yml +++ b/.github/workflows/itests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - dotnet-version: ['8.0', '9.0'] + dotnet-version: ['8.0', '9.0', '10.0'] include: - dotnet-version: '8.0' display-name: '.NET 8.0' @@ -22,14 +22,19 @@ jobs: framework: 'net9' prefix: 'net9' install-version: '9.0.x' + - dotnet-version: '10.0' + display-name: '.NET 10.0' + framework: 'net10' + prefix: 'net10' + install-version: '10.0.x' env: NUPKG_OUTDIR: bin/Release/nugets GOVER: 1.20.3 GOOS: linux GOARCH: amd64 GOPROXY: https://proxy.golang.org - DAPR_CLI_VER: 1.15.2 - DAPR_RUNTIME_VER: 1.16.0-rc.6 + DAPR_CLI_VER: 1.16.0 + DAPR_RUNTIME_VER: 1.16.1 DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.16/install/install.sh DAPR_CLI_REF: '' steps: @@ -94,16 +99,19 @@ jobs: 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-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: Setup .NET 10 (required) + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '10.0.x' + dotnet-quality: 'preview' - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/sdk_build.yml b/.github/workflows/sdk_build.yml index 113858f0d..ad1908bc9 100644 --- a/.github/workflows/sdk_build.yml +++ b/.github/workflows/sdk_build.yml @@ -27,11 +27,21 @@ jobs: - uses: actions/checkout@v1 - name: Parse release version run: python ./.github/scripts/get_release_version.py - - name: Setup .NET Core + - name: Setup .NET 8 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + dotnet-quality: 'ga' + - name: Setup .NET 9 uses: actions/setup-dotnet@v3 with: dotnet-version: 9.0.x dotnet-quality: 'ga' + - name: Setup .NET 10 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 10.0.x + dotnet-quality: 'preview' - name: Restore dependencies run: dotnet restore - name: Build @@ -50,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - dotnet-version: ['8.0', '9.0'] + dotnet-version: ['8.0', '9.0', '10.0'] include: - dotnet-version: '8.0' display-name: '.NET 8.0' @@ -62,6 +72,11 @@ jobs: framework: 'net9' prefix: 'net9' install-version: '9.0.x' + - dotnet-version: '10.0' + display-name: '.NET 10.0' + framework: 'net10' + prefix: 'net10' + install-version: '10.0.x' steps: - uses: actions/checkout@v1 - name: Parse release version @@ -73,16 +88,19 @@ jobs: 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-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: Setup .NET 10 (required) + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '10.0.x' + dotnet-quality: 'preview' - 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 diff --git a/Directory.Packages.props b/Directory.Packages.props index 6db58e8e9..e12172bf3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,9 +19,11 @@ - + + - + + @@ -31,17 +33,17 @@ - - - - - - - - - - - + + + + + + + + + + + @@ -50,10 +52,10 @@ - - + + - + \ No newline at end of file diff --git a/examples/Directory.Build.props b/examples/Directory.Build.props index 0c8af6eaf..c98f86a8b 100644 --- a/examples/Directory.Build.props +++ b/examples/Directory.Build.props @@ -2,7 +2,7 @@ - net8;net9 + net8.0;net9.0;net10.0 $(RepoRoot)bin\$(Configuration)\examples\$(MSBuildProjectName)\ diff --git a/examples/Hosting/Aspire/ServiceInvocationDemo/FrontendApp/FrontendApp.csproj b/examples/Hosting/Aspire/ServiceInvocationDemo/FrontendApp/FrontendApp.csproj index f1e3f0c23..3424ff655 100644 --- a/examples/Hosting/Aspire/ServiceInvocationDemo/FrontendApp/FrontendApp.csproj +++ b/examples/Hosting/Aspire/ServiceInvocationDemo/FrontendApp/FrontendApp.csproj @@ -8,7 +8,7 @@ - + diff --git a/examples/Hosting/Aspire/ServiceInvocationDemo/ServiceInvocationDemo.AppHost/ServiceInvocationDemo.AppHost.csproj b/examples/Hosting/Aspire/ServiceInvocationDemo/ServiceInvocationDemo.AppHost/ServiceInvocationDemo.AppHost.csproj index 07e655631..24e56dcd3 100644 --- a/examples/Hosting/Aspire/ServiceInvocationDemo/ServiceInvocationDemo.AppHost/ServiceInvocationDemo.AppHost.csproj +++ b/examples/Hosting/Aspire/ServiceInvocationDemo/ServiceInvocationDemo.AppHost/ServiceInvocationDemo.AppHost.csproj @@ -1,6 +1,6 @@ - + Exe @@ -13,8 +13,8 @@ - - + + diff --git a/global.json b/global.json index b86bbe43e..b01d305e4 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { - "_comment": "This policy allows the 9.0.100 SDK or patches in that family.", + "_comment": "This policy allows the 10.0.0 SDK or patches in that family.", "sdk": { - "version": "9.0.100", + "version": "10.0.0", "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e7b1b91fa..c0c8e2c77 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,7 +3,7 @@ - net8;net9 + net8.0;net9.0;net10.0 $(RepoRoot)bin\$(Configuration)\prod\$(MSBuildProjectName)\ $(OutputPath)$(MSBuildProjectName).xml diff --git a/test/Dapr.Actors.Analyzers.Test/TimerCallbackMethodPresentAnalyzerTests.cs b/test/Dapr.Actors.Analyzers.Test/TimerCallbackMethodPresentAnalyzerTests.cs index e3fd47f31..f1621a53d 100644 --- a/test/Dapr.Actors.Analyzers.Test/TimerCallbackMethodPresentAnalyzerTests.cs +++ b/test/Dapr.Actors.Analyzers.Test/TimerCallbackMethodPresentAnalyzerTests.cs @@ -23,14 +23,17 @@ public class TimerCallbackMethodPresentAnalyzerTests private static readonly ReferenceAssemblies assemblies = ReferenceAssemblies.Net.Net80; #elif NET9_0 private static readonly ReferenceAssemblies assemblies = ReferenceAssemblies.Net.Net90; + #elif NET10_0 + private static readonly ReferenceAssemblies assemblies = new ReferenceAssemblies("net10.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "10.0.0-rc.1.25451.107"), Path.Combine("ref", "net10.0")); #endif + [Fact] public async Task TestActor_TimerRegistration_NotPresent() { var context = new CSharpAnalyzerTest(); context.ReferenceAssemblies = assemblies.AddPackages([ - new ("Dapr.Actors", "1.15.3") + new ("Dapr.Actors", "1.16.0") ]); context.TestCode = """ @@ -55,7 +58,7 @@ public async Task TestActor_TimerRegistration_NameOfCallbackPresent() { var context = new CSharpAnalyzerTest(); context.ReferenceAssemblies = assemblies.AddPackages([ - new ("Dapr.Actors", "1.15.3") + new ("Dapr.Actors", "1.16.0") ]); @@ -86,7 +89,7 @@ public async Task TestActor_TimerRegistration_LiteralCallbackPresent() { var context = new CSharpAnalyzerTest(); context.ReferenceAssemblies = assemblies.AddPackages([ - new ("Dapr.Actors", "1.15.3") + new ("Dapr.Actors", "1.16.0") ]); @@ -117,7 +120,7 @@ public async Task TestActor_TimerRegistration_CallbackNotPresent() { var context = new CSharpAnalyzerTest(); context.ReferenceAssemblies = assemblies.AddPackages([ - new ("Dapr.Actors", "1.15.3") + new ("Dapr.Actors", "1.16.0") ]); context.TestCode = """ diff --git a/test/Dapr.Actors.Generators.Test/CSharpSourceGeneratorVerifier.cs b/test/Dapr.Actors.Generators.Test/CSharpSourceGeneratorVerifier.cs index ef1d7b9a0..e6fcc7889 100644 --- a/test/Dapr.Actors.Generators.Test/CSharpSourceGeneratorVerifier.cs +++ b/test/Dapr.Actors.Generators.Test/CSharpSourceGeneratorVerifier.cs @@ -36,6 +36,8 @@ public Test() 8; #elif NET9_0 9; +#elif NET10_0 + 10; #endif // @@ -48,7 +50,7 @@ public Test() this.ReferenceAssemblies = new ReferenceAssemblies( - $"net{frameworkVersion}.0", + $"net{(frameworkVersion)}.0", new PackageIdentity( "Microsoft.NETCore.App.Ref", $"{frameworkVersion}.0.0"), diff --git a/test/Dapr.Analyzers.Common/TestUtilities.cs b/test/Dapr.Analyzers.Common/TestUtilities.cs index b6db51472..a8a3cae5f 100644 --- a/test/Dapr.Analyzers.Common/TestUtilities.cs +++ b/test/Dapr.Analyzers.Common/TestUtilities.cs @@ -35,6 +35,8 @@ internal static class TestUtilities var referenceAssemblies = ReferenceAssemblies.Net.Net80; #elif NET9_0 var referenceAssemblies = ReferenceAssemblies.Net.Net90; + #elif NET10_0 + var referenceAssemblies = new ReferenceAssemblies("net10.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "10.0.0-rc.1.25451.107"), Path.Combine("ref", "net10.0")); #endif // Create a new project with necessary references diff --git a/test/Dapr.AspNetCore.Test/CloudEventsMiddlewareTest.cs b/test/Dapr.AspNetCore.Test/CloudEventsMiddlewareTest.cs index 54e099be5..539c97a80 100644 --- a/test/Dapr.AspNetCore.Test/CloudEventsMiddlewareTest.cs +++ b/test/Dapr.AspNetCore.Test/CloudEventsMiddlewareTest.cs @@ -402,7 +402,7 @@ public async Task InvokeAsync_ReadsBinaryData() { httpContext.Request.ContentType.ShouldBe(dataContentType); var bytes = new byte[httpContext.Request.Body.Length]; -#if NET9_0 +#if NET9_0_OR_GREATER httpContext.Request.Body.ReadExactly(bytes, 0, bytes.Length); #else httpContext.Request.Body.Read(bytes, 0, bytes.Length); @@ -470,7 +470,7 @@ private static string ReadBody(Stream stream, Encoding encoding = null) encoding ??= Encoding.UTF8; var bytes = new byte[stream.Length]; -#if NET9_0 +#if NET9_0_OR_GREATER stream.ReadExactly(bytes, 0, bytes.Length); #else stream.Read(bytes, 0, bytes.Length); @@ -478,4 +478,4 @@ private static string ReadBody(Stream stream, Encoding encoding = null) var str = encoding.GetString(bytes); return str; } -} \ No newline at end of file +} diff --git a/test/Dapr.Jobs.Test/Extensions/EndpointRouteBuilderExtensionsTests.cs b/test/Dapr.Jobs.Test/Extensions/EndpointRouteBuilderExtensionsTests.cs index 77b60fe06..7b2b4d62e 100644 --- a/test/Dapr.Jobs.Test/Extensions/EndpointRouteBuilderExtensionsTests.cs +++ b/test/Dapr.Jobs.Test/Extensions/EndpointRouteBuilderExtensionsTests.cs @@ -24,6 +24,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace Dapr.Jobs.Test.Extensions; @@ -33,7 +34,7 @@ public class EndpointRouteBuilderExtensionsTest [Fact] public async Task MapDaprScheduledJobHandler_ValidRequest_ExecutesAction() { - var server = CreateTestServer(); + var server = await CreateTestServer(); var client = server.CreateClient(); var serializedPayload = JsonSerializer.Serialize(new SamplePayload("Dapr", 789)); @@ -53,7 +54,7 @@ public async Task MapDaprScheduledJobHandler_ValidRequest_ExecutesAction() [Fact] public async Task MapDaprScheduleJobHandler_HandleMissingCancellationToken() { - var server = CreateTestServer2(); + var server = await CreateTestServer2(); var client = server.CreateClient(); var serializedPayload = JsonSerializer.Serialize(new SamplePayload("Dapr", 789)); @@ -76,40 +77,45 @@ public async Task MapDaprScheduledJobHandler_HandlesTimeoutCorrectly() // Arrange var timeout = TimeSpan.FromSeconds(5); const string testJobName = "testJob"; - var testJobPayload = Encoding.UTF8.GetBytes("testPayload"); + var testJobPayload = "testPayload"u8.ToArray(); - var builder = new WebHostBuilder() - .ConfigureServices(services => + var builder = new HostBuilder(); + builder.ConfigureServices(services => { services.AddLogging(); services.AddRouting(); }) - .Configure(app => + .ConfigureWebHost(webBuilder => { - app.UseRouting(); - app.UseEndpoints(endpoints => + webBuilder.Configure(app => { - endpoints.MapDaprScheduledJobHandler(async ( - string jobName, - ReadOnlyMemory jobPayload, - ILogger? logger, - CancellationToken cancellationToken) => + app.UseRouting(); + app.UseEndpoints(endpoints => { - logger?.LogInformation("Received trigger invocation for job '{jobName}'", jobName); + endpoints.MapDaprScheduledJobHandler(async ( + string jobName, + ReadOnlyMemory jobPayload, + ILogger? logger, + CancellationToken cancellationToken) => + { + logger?.LogInformation("Received trigger invocation for job '{jobName}'", jobName); - var deserializedPayload = Encoding.UTF8.GetString(jobPayload.Span); - logger?.LogInformation( - "Received invocation for the job '{jobName}' with payload '{deserializedPayload}'", - jobName, deserializedPayload); - await Task.Delay(TimeSpan.FromSeconds(1), - cancellationToken); //Less than the timeout, so this should work without throwing + var deserializedPayload = Encoding.UTF8.GetString(jobPayload.Span); + logger?.LogInformation( + "Received invocation for the job '{jobName}' with payload '{deserializedPayload}'", + jobName, deserializedPayload); + await Task.Delay(TimeSpan.FromSeconds(1), + cancellationToken); //Less than the timeout, so this should work without throwing - return Task.CompletedTask; - }, timeout); + return Task.CompletedTask; + }, timeout); + }); }); }); - var testServer = new TestServer(builder); + var host = await builder.StartAsync(); + var testServer = host.GetTestServer(); + var client = testServer.CreateClient(); var requestContent = new ByteArrayContent(testJobPayload); @@ -129,40 +135,44 @@ public async Task MapDaprScheduledJobHandler_AppliesTimeoutCorrectly() // Arrange var timeout = TimeSpan.FromSeconds(1); const string testJobName = "testJob"; - var testJobPayload = Encoding.UTF8.GetBytes("testPayload"); - - var builder = new WebHostBuilder() - .ConfigureServices(services => + var testJobPayload = "testPayload"u8.ToArray(); + + var builder = new HostBuilder(); + builder.ConfigureServices(services => { services.AddLogging(); services.AddRouting(); }) - .Configure(app => + .ConfigureWebHost(webBuilder => { - app.UseRouting(); - app.UseEndpoints(endpoints => + webBuilder.Configure(app => { - endpoints.MapDaprScheduledJobHandler(async ( - string jobName, - ReadOnlyMemory jobPayload, - ILogger? logger, - CancellationToken cancellationToken) => + app.UseRouting(); + app.UseEndpoints(endpoints => { - logger?.LogInformation("Received trigger invocation for job '{jobName}'", jobName); + endpoints.MapDaprScheduledJobHandler(async ( + string jobName, + ReadOnlyMemory jobPayload, + ILogger? logger, + CancellationToken cancellationToken) => + { + logger?.LogInformation("Received trigger invocation for job '{jobName}'", jobName); - var deserializedPayload = Encoding.UTF8.GetString(jobPayload.Span); - logger?.LogInformation( - "Received invocation for the job '{jobName}' with payload '{deserializedPayload}'", - jobName, deserializedPayload); - await Task.Delay(timeout.Add(TimeSpan.FromSeconds(3)), - cancellationToken); //Intentionally delay longer than the timeout allows + var deserializedPayload = Encoding.UTF8.GetString(jobPayload.Span); + logger?.LogInformation( + "Received invocation for the job '{jobName}' with payload '{deserializedPayload}'", + jobName, deserializedPayload); + await Task.Delay(timeout.Add(TimeSpan.FromSeconds(3)), + cancellationToken); //Intentionally delay longer than the timeout allows - return Task.CompletedTask; - }, timeout); + return Task.CompletedTask; + }, timeout); + }); }); }); - var testServer = new TestServer(builder); + var host = await builder.StartAsync(); + var testServer = host.GetTestServer(); var client = testServer.CreateClient(); var requestContent = new ByteArrayContent(testJobPayload); @@ -183,55 +193,66 @@ public sealed class Validator public string? SerializedPayload { get; set; } } - private static TestServer CreateTestServer() + private static async Task CreateTestServer() { - var builder = new WebHostBuilder() + var builder = new HostBuilder() .ConfigureServices(services => { services.AddSingleton(); services.AddRouting(); }) - .Configure(app => + .ConfigureWebHost(host => { - app.UseRouting(); - app.UseEndpoints(endpoints => + host.Configure(app => { - endpoints.MapDaprScheduledJobHandler(async (string jobName, ReadOnlyMemory jobPayload, Validator validator, CancellationToken cancellationToken) => + app.UseRouting(); + app.UseEndpoints(endpoints => { - validator.JobName = jobName; - validator.SerializedPayload = Encoding.UTF8.GetString(jobPayload.Span); - await Task.CompletedTask; + endpoints.MapDaprScheduledJobHandler(async (string jobName, ReadOnlyMemory jobPayload, + Validator validator, CancellationToken cancellationToken) => + { + validator.JobName = jobName; + validator.SerializedPayload = Encoding.UTF8.GetString(jobPayload.Span); + await Task.CompletedTask; + }); }); }); }); - return new TestServer(builder); + var host = await builder.StartAsync(); + var testServer = host.GetTestServer(); + return testServer; } - private static TestServer CreateTestServer2() + private static async Task CreateTestServer2() { - var builder = new WebHostBuilder() + var builder = new HostBuilder() .ConfigureServices(services => { services.AddSingleton(); services.AddRouting(); }) - .Configure(app => + .ConfigureWebHost(host => { - app.UseRouting(); - app.UseEndpoints(endpoints => + host.Configure(app => { - endpoints.MapDaprScheduledJobHandler(async (string jobName, Validator validator, ReadOnlyMemory payload) => + app.UseRouting(); + app.UseEndpoints(endpoints => { - validator.JobName = jobName; - - var payloadString = Encoding.UTF8.GetString(payload.Span); - validator.SerializedPayload = payloadString; - await Task.CompletedTask; + endpoints.MapDaprScheduledJobHandler(async (string jobName, Validator validator, + ReadOnlyMemory payload) => + { + validator.JobName = jobName; + + var payloadString = Encoding.UTF8.GetString(payload.Span); + validator.SerializedPayload = payloadString; + await Task.CompletedTask; + }); }); }); }); - return new TestServer(builder); + var host = await builder.StartAsync(); + return host.GetTestServer(); } } diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 65b969f3b..835f82a70 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,7 +2,7 @@ - net8;net9 + net8.0;net9.0;net10.0 $(RepoRoot)bin\$(Configuration)\test\$(MSBuildProjectName)\