diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2364fe72..4ab2888b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 9.x - name: Install dependencies run: dotnet restore @@ -99,7 +99,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.x' + dotnet-version: '9.x' source-url: "https://pkgs.dev.azure.com/tingle/_packaging/tingle/nuget/v3/index.json" env: NUGET_AUTH_TOKEN: ${{ secrets.PRIVATE_FEED_API_KEY }} @@ -125,7 +125,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.x' + dotnet-version: '9.x' source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json env: NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -151,7 +151,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 9.x source-url: https://api.nuget.org/v3/index.json env: NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} diff --git a/Directory.Build.props b/Directory.Build.props index 435d083a..d10a9719 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - net7.0;net8.0 + net8.0;net9.0 latest enable enable diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7a8f7b95..d1a7ec3b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,12 +3,12 @@ - netstandard2.1;net6.0;net7.0;net8.0 + netstandard2.1;net8.0;net9.0 true true Tingle Software Tingle Software - true + true diff --git a/src/Tingle.EventBus/Configuration/EventConsumerRegistration.cs b/src/Tingle.EventBus/Configuration/EventConsumerRegistration.cs index e03d467a..8a1cc68a 100644 --- a/src/Tingle.EventBus/Configuration/EventConsumerRegistration.cs +++ b/src/Tingle.EventBus/Configuration/EventConsumerRegistration.cs @@ -100,6 +100,7 @@ private EventConsumerRegistration(Type consumerType, bool deadletter, ConsumeDel /// The type of consumer. /// Indicates if the consumer should be connected to the dead-letter entity. [RequiresDynamicCode(MessageStrings.GenericsDynamicCodeMessage)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public static EventConsumerRegistration Create([DynamicallyAccessedMembers(TrimmingHelper.Event)] Type eventType, [DynamicallyAccessedMembers(TrimmingHelper.Consumer)] Type consumerType, bool deadletter) => new(consumerType, deadletter, ExecutionHelper.MakeDelegate(eventType, consumerType)); diff --git a/src/Tingle.EventBus/Configuration/EventRegistration.cs b/src/Tingle.EventBus/Configuration/EventRegistration.cs index 6582bbe6..3087693f 100644 --- a/src/Tingle.EventBus/Configuration/EventRegistration.cs +++ b/src/Tingle.EventBus/Configuration/EventRegistration.cs @@ -105,6 +105,7 @@ private EventRegistration(Type eventType, DeserializerDelegate deserializer) // /// Create a new instance of for the specified event type. /// The type of event. [RequiresDynamicCode(MessageStrings.GenericsDynamicCodeMessage)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public static EventRegistration Create([DynamicallyAccessedMembers(TrimmingHelper.Event)] Type eventType) => new(eventType, ExecutionHelper.MakeDelegate(eventType)); #region Equality Overrides diff --git a/src/Tingle.EventBus/DependencyInjection/EventBusBuilder.cs b/src/Tingle.EventBus/DependencyInjection/EventBusBuilder.cs index d210c0b5..c8c1d171 100644 --- a/src/Tingle.EventBus/DependencyInjection/EventBusBuilder.cs +++ b/src/Tingle.EventBus/DependencyInjection/EventBusBuilder.cs @@ -236,6 +236,7 @@ public EventBusBuilder UseDefaultJsonSerializerTrimmable(System.Text.Json.Serial /// /// [RequiresDynamicCode(ConsumersRequiresDynamicCode)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public EventBusBuilder AddConsumer<[DynamicallyAccessedMembers(TrimmingHelper.Consumer)] TConsumer>( Action configure) where TConsumer : class, IEventConsumer { @@ -322,6 +323,7 @@ public EventBusBuilder UseDefaultJsonSerializerTrimmable(System.Text.Json.Serial /// /// [RequiresDynamicCode(ConsumersRequiresDynamicCode)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public EventBusBuilder AddConsumer<[DynamicallyAccessedMembers(TrimmingHelper.Consumer)] TConsumer>( Action? configure = null) where TConsumer : class, IEventConsumer { diff --git a/src/Tingle.EventBus/Internal/ExecutionHelper.cs b/src/Tingle.EventBus/Internal/ExecutionHelper.cs index 70eeac05..e34d6e23 100644 --- a/src/Tingle.EventBus/Internal/ExecutionHelper.cs +++ b/src/Tingle.EventBus/Internal/ExecutionHelper.cs @@ -53,6 +53,7 @@ await registration.ExecutionPipeline.ExecuteAsync( } [RequiresDynamicCode(MessageStrings.GenericsDynamicCodeMessage)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public static DeserializerDelegate MakeDelegate([DynamicallyAccessedMembers(TrimmingHelper.Event)] Type eventType) { var flags = System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public; @@ -62,6 +63,7 @@ public static DeserializerDelegate MakeDelegate([DynamicallyAccessedMembers(Trim } [RequiresDynamicCode(MessageStrings.GenericsDynamicCodeMessage)] + [RequiresUnreferencedCode(MessageStrings.GenericsUnreferencedCodeMessage)] public static ConsumeDelegate MakeDelegate([DynamicallyAccessedMembers(TrimmingHelper.Event)] Type eventType, [DynamicallyAccessedMembers(TrimmingHelper.Consumer)] Type consumerType) { var flags = System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public; diff --git a/src/Tingle.EventBus/MessageStrings.cs b/src/Tingle.EventBus/MessageStrings.cs index a4f4f2f8..5cb4a9aa 100644 --- a/src/Tingle.EventBus/MessageStrings.cs +++ b/src/Tingle.EventBus/MessageStrings.cs @@ -13,5 +13,6 @@ internal class MessageStrings public const string RequiresUnreferencedCodeMessage = "JSON serialization, deserialization, and binding strongly typed objects to configuration values might require types that cannot be statically analyzed."; public const string RequiresDynamicCodeMessage = "JSON serialization, deserialization, and binding strongly typed objects to configuration values might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications."; - public const string GenericsDynamicCodeMessage = "The native code for this instantiation might not be available at runtime"; + public const string GenericsUnreferencedCodeMessage = "The native code for this instantiation might require types that cannot be statically analyzed."; + public const string GenericsDynamicCodeMessage = "The native code for this instantiation might not be available at runtime."; }