Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: [ self-hosted, type-cpx52, setup-docker, volume-cache-50GB ]
strategy:
matrix:
dotnet-version: [ '8.0', '9.0' ]
dotnet-version: [ '8.0', '9.0', '10.0' ]
env:
NUGET_PACKAGES: "/mnt/cache/.nuget/packages"
DOTNET_INSTALL_DIR: "/mnt/cache/.dotnet"
Expand All @@ -36,6 +36,8 @@ jobs:
dotnet-version: |
8.0
9.0
10.0
dotnet-quality: 'preview'
-
name: Login to Docker Hub
if: ${{ github.event.pull_request.head.repo.fork == false }}
Expand Down
32 changes: 19 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<PropertyGroup Label="Package versions for .NET 10" Condition="'$(TargetFramework)' == 'net10.0'">
<MicrosoftTestHostVer>10.0.0-rc.2.25502.107</MicrosoftTestHostVer>
<MicrosoftExtensionsVer>10.0.0-rc.2.25502.107</MicrosoftExtensionsVer>
</PropertyGroup>
<PropertyGroup Label="Package versions for .NET 9" Condition="'$(TargetFramework)' == 'net9.0'">
<MicrosoftTestHostVer>9.0.6</MicrosoftTestHostVer>
<MicrosoftTestHostVer>9.0.10</MicrosoftTestHostVer>
<MicrosoftExtensionsVer>9.0.10</MicrosoftExtensionsVer>
</PropertyGroup>
<PropertyGroup Label="Package versions for .NET 8" Condition="'$(TargetFramework)' == 'net8.0'">
<MicrosoftTestHostVer>8.0.17</MicrosoftTestHostVer>
<MicrosoftTestHostVer>8.0.21</MicrosoftTestHostVer>
<MicrosoftExtensionsVer>9.0.10</MicrosoftExtensionsVer>
</PropertyGroup>
Comment on lines +14 to 16

Choose a reason for hiding this comment

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

Suggestion: Correct .NET 8 package versions

Suggested change
<MicrosoftTestHostVer>8.0.21</MicrosoftTestHostVer>
<MicrosoftExtensionsVer>9.0.10</MicrosoftExtensionsVer>
</PropertyGroup>
<MicrosoftTestHostVer>8.0.21</MicrosoftTestHostVer>
<MicrosoftExtensionsVer>8.0.0</MicrosoftExtensionsVer>
</PropertyGroup>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The suggestion is not correct. Microsoft extension packages 9.0.6 support .NET 8.

Choose a reason for hiding this comment

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

Question:

The suggestion is not correct. Microsoft extension packages 9.0.6 support .NET 8.

Answer:

You can steer suggestions to respect your .NET versioning policy via configuration.

Add repo-specific guidance so the Improve tool won’t “downgrade” Microsoft.Extensions packages when targeting .NET 8:

[pr_code_suggestions]
extra_instructions="""\
- Do not suggest lowering Microsoft.Extensions.* package versions for .NET 8 projects.
- When TargetFramework is net8.0, prefer Microsoft.Extensions.* >= 9.0.6 unless the PR explicitly pins a different version.
- Treat SDK/runtime compatibility as authoritative: .NET 8 supports Microsoft.Extensions.* 9.x.
- If proposing package changes, explain compatibility and link to the justification in the suggestion.
"""

Optionally, encode this as an organizational best practice so it’s applied consistently:

  • Create best_practices.md in the repo (or use global best practices) with a rule like:
    “For net8.0 projects, Microsoft.Extensions.* packages should be 9.0.6 or newer unless constrained by transitive compatibility.”

If you still see incorrect version proposals, note this is an AI limitation; keeping the above instructions and best practices short, explicit, and close to your conventions usually resolves it.

Relevant Sources:

<PropertyGroup Label="Testcontainers version">
<TestcontainersVersion>4.6.0</TestcontainersVersion>
Expand All @@ -18,19 +24,19 @@
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="FluentValidation" Version="12.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.6" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="$(MicrosoftExtensionsVer)" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
27 changes: 24 additions & 3 deletions src/Core/test/Eventuous.Tests.Subscriptions/RegistrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging.Abstractions;
using Shouldly;
using LoggingExtensions = Eventuous.TestHelpers.TUnit.Logging.LoggingExtensions;
Expand All @@ -17,9 +18,31 @@
namespace Eventuous.Tests.Subscriptions;

public class RegistrationTests {
readonly TestServer _server = new(BuildHost());
TestServer _server = null!;
IHost _host = null!;

readonly ILoggerFactory _logger = LoggingExtensions.GetLoggerFactory();

[Before(Test)]
public async Task Setup() {
_host = new HostBuilder()
.ConfigureWebHost(webHostBuilder => webHostBuilder
.UseTestServer()
.UseStartup<Startup>()
)
.Build();
await _host.StartAsync();

_server = _host.GetTestServer();
}

[After(Test)]
public async Task Teardown() {
_server.Dispose();
await _host.StopAsync();
_host.Dispose();
}

[Test]
public void ShouldBeSingletons() {
var subs1 = _server.Services.GetServices<TestSub>().ToArray();
Expand Down Expand Up @@ -105,8 +128,6 @@ public void ShouldRegisterTwoMeasures() {
_server.Services.GetRequiredService<SubscriptionMetrics>();
}

static IWebHostBuilder BuildHost() => new WebHostBuilder().UseStartup<Startup>();

class Startup {
public static void ConfigureServices(IServiceCollection services) {
services.AddSingleton(new TestHandlerLogger());
Expand Down
6 changes: 1 addition & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<LangVersion>preview</LangVersion>
<NoWarn>$(NoWarn);CS1591;CS0618;</NoWarn>
<Nullable>enable</Nullable>
Expand All @@ -23,12 +23,8 @@
</PropertyGroup>
<Import Project="$(RepoRoot)\props\Common.props"/>
<PropertyGroup Condition="$(MSBuildProjectName.StartsWith('Eventuous.Tests'))">
<VSTestLogger>trx%3bLogFileName=$(MSBuildProjectName).trx</VSTestLogger>
<VSTestResultsDirectory>$(RepoRoot)/test-results/$(TargetFramework)</VSTestResultsDirectory>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<TestingPlatformCommandLineArguments>--report-trx --results-directory $(RepoRoot)/test-results/$(TargetFramework)</TestingPlatformCommandLineArguments>
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<ProjectReference Include="$(CoreRoot)\Eventuous.Subscriptions\Eventuous.Subscriptions.csproj"/>
<ProjectReference Include="$(CoreRoot)\Eventuous.Persistence\Eventuous.Persistence.csproj"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="System.Linq.Async" ExcludeAssets="Compile"/>
</ItemGroup>
<ItemGroup>
<Using Include="EventStore.Client"/>
<Using Include="Eventuous.Subscriptions"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@
<ProjectReference Include="$(DiagRoot)\Eventuous.Diagnostics.Logging\Eventuous.Diagnostics.Logging.csproj"/>
<ProjectReference Include="$(ExtRoot)\Eventuous.Extensions.DependencyInjection\Eventuous.Extensions.DependencyInjection.csproj"/>
<ProjectReference Include="$(LocalRoot)\Eventuous.EventStore\Eventuous.EventStore.csproj"/>
<ProjectReference Include="$(SrcRoot)\Core\gen\Eventuous.Shared.Generators\Eventuous.Shared.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="$(SrcRoot)\Core\gen\Eventuous.Shared.Generators\Eventuous.Shared.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="$(CoreTestRoot)\Eventuous.Tests.Persistence.Base\Eventuous.Tests.Persistence.Base.csproj"/>
<ProjectReference Include="$(SrcRoot)\Diagnostics\test\Eventuous.Tests.OpenTelemetry\Eventuous.Tests.OpenTelemetry.csproj"/>
<ProjectReference Include="$(CoreTestRoot)\Eventuous.Tests.Subscriptions.Base\Eventuous.Tests.Subscriptions.Base.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NodaTime.Serialization.SystemTextJson"/>
<PackageReference Include="Shouldly" />
<PackageReference Include="Shouldly"/>
<PackageReference Include="Testcontainers.EventStoreDb"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="System.Linq.Async" ExcludeAssets="Compile"/>
</ItemGroup>
<ItemGroup>
<Using Include="NodaTime"/>
<Using Include="Eventuous.Subscriptions"/>
Expand Down
17 changes: 12 additions & 5 deletions src/Gateway/test/Eventuous.Tests.Gateway/RegistrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging.Abstractions;

// ReSharper disable ClassNeverInstantiated.Local
Expand All @@ -15,12 +16,18 @@ namespace Eventuous.Tests.Gateway;

public class RegistrationTests {
[Test]
public void Test() {
TestServer host = new(BuildHost());
host.Dispose();
}
public async Task Test() {
using var host = new HostBuilder()
.ConfigureWebHost(webHostBuilder => webHostBuilder
.UseTestServer()
.UseStartup<Startup>()
)
.Build();
await host.StartAsync();

static IWebHostBuilder BuildHost() => new WebHostBuilder().UseStartup<Startup>();
var testServer = host.GetTestServer();
testServer.Dispose();
}

class Startup {
public static void ConfigureServices(IServiceCollection services) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
<PackageReference Include="Npgsql"/>
<PackageReference Include="Npgsql.DependencyInjection"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net10.0'">
<PackageReference Include="System.Linq.Async"/>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ protected override async Task<ReceivedEvent[]> ReadEvents(IDatabase database, lo
var stream = linkEvent[EventuousRedisKeys.Stream];
var streamPosition = linkEvent[Position];

var streamEvents = await database.StreamRangeAsync(new RedisKey(stream), streamPosition).NoContext();
var streamEvents = await database.StreamRangeAsync(new(stream), streamPosition).NoContext();
var entry = streamEvents[0];

persistentEvents.Add(
new ReceivedEvent(
Guid.Parse(entry[MessageId]!),
new(
Guid.Parse(entry[MessageId].ToString()),
entry[MessageType]!,
entry.Id.ToLong(),
entry.Id.ToLong(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override async Task<ReceivedEvent[]> ReadEvents(IDatabase database, lo

return events.Select(
evt => new ReceivedEvent(
Guid.Parse(evt[MessageId]!),
Guid.Parse(evt[MessageId].ToString()),
evt[MessageType]!,
evt.Id.ToLong(),
evt.Id.ToLong(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ProjectReference Include="$(CoreRoot)\Eventuous.Persistence\Eventuous.Persistence.csproj" />
<ProjectReference Include="$(CoreRoot)\Eventuous.Producers\Eventuous.Producers.csproj" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net10.0'">
<PackageReference Include="System.Linq.Async"/>
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ StreamEvent ToStreamEvent(PersistedEvent evt) {
FailedToDeserialize failed => throw new SerializationException($"Can't deserialize {evt.MessageType}: {failed.Error}"),
_ => throw new("Unknown deserialization result")
};

StreamEvent AsStreamEvent(object payload) => new(evt.MessageId, payload, meta ?? new Metadata(), ContentType, evt.StreamPosition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
<PackageReference Include="System.Linq.Async"/>
<Using Include="Microsoft.Data.SqlClient"/>
<Using Include="System.Data"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net10.0'">
<PackageReference Include="System.Linq.Async"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scripts\1_Schema.sql"/>
<EmbeddedResource Include="Scripts\2_AppendEvents.sql"/>
Expand Down
Loading