diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Azure.Messaging.ServiceBus.csproj b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Azure.Messaging.ServiceBus.csproj index eed9d3b07c026..162b329ea6b8a 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Azure.Messaging.ServiceBus.csproj +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Azure.Messaging.ServiceBus.csproj @@ -12,6 +12,8 @@ $(NoWarn);CA2213 true + true + true diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Compatibility/ServiceBusClientBuilderExtensions.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Compatibility/ServiceBusClientBuilderExtensions.cs index 4e1c60deabd85..8b92df8490e6b 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Compatibility/ServiceBusClientBuilderExtensions.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Compatibility/ServiceBusClientBuilderExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using Azure.Core.Extensions; using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Administration; @@ -37,6 +38,8 @@ public static IAzureClientBuilder Add /// Registers a instance with connection options loaded from the provided instance. /// /// + [RequiresUnreferencedCode("Binding strongly typed objects to configuration values is not supported with trimming. Use the Configuration Binder Source Generator (EnableConfigurationBindingGenerator=true) instead.")] + [RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types. Use the Configuration Binder Source Generator (EnableConfigurationBindingGenerator=true) instead.")] public static IAzureClientBuilder AddServiceBusClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { @@ -78,6 +81,8 @@ public static IAzureClientBuilder instance with connection options loaded from the provided instance. /// /// + [RequiresUnreferencedCode("Binding strongly typed objects to configuration values is not supported with trimming. Use the Configuration Binder Source Generator (EnableConfigurationBindingGenerator=true) instead.")] + [RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types. Use the Configuration Binder Source Generator (EnableConfigurationBindingGenerator=true) instead.")] public static IAzureClientBuilder AddServiceBusAdministrationClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Diagnostics/ServiceBusEventSource.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Diagnostics/ServiceBusEventSource.cs index 8bb5f135106b3..f43f2011d6bde 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Diagnostics/ServiceBusEventSource.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Diagnostics/ServiceBusEventSource.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Tracing; using System.Linq; using System.Reflection; @@ -385,6 +386,7 @@ public virtual void PeekMessageStart(string identifier, long? sequenceNumber, in [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void PeekMessageStartCore(int eventId, string identifier, long? sequenceNumber, int messageCount) { fixed (char* identifierPtr = identifier) @@ -1094,6 +1096,7 @@ private void ProcessorMessageHandlerExceptionCore(string identifier, long sequen [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void ProcessorMessageHandlerExceptionCore(int eventId, string identifier, long sequenceNumber, string exception, string lockToken) { fixed (char* identifierPtr = identifier) @@ -1254,6 +1257,7 @@ public virtual void LinkStateLost(string identifier, string receiveLinkName, str [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void LinkStateLostCore(int eventId, string identifier, string receiveLinkName, string receiveLinkState, bool isSessionReceiver, string exception) { fixed (char* identifierPtr = identifier) @@ -1807,6 +1811,7 @@ public void TransactionDischarged(string transactionId, string amqpTransactionId [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void TransactionDischargedCore(int eventId, string transactionId, string amqpTransactionId, bool rollback) { fixed (char* transactionIdPtr = transactionId) @@ -1909,6 +1914,7 @@ public virtual void PartitionKeyOverwritten(string partitionKey, string sessionI /// The third argument. [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void WriteEvent(int eventId, string arg1, int arg2, string arg3) { fixed (char* arg1Ptr = arg1) @@ -1940,6 +1946,7 @@ private unsafe void WriteEvent(int eventId, string arg1, int arg2, string arg3) /// The third argument. [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void WriteEvent(int eventId, string arg1, long arg2, string arg3) { fixed (char* arg1Ptr = arg1) @@ -1971,6 +1978,7 @@ private unsafe void WriteEvent(int eventId, string arg1, long arg2, string arg3) /// The fourth argument. [NonEvent] [MethodImpl(MethodImplOptions.AggressiveInlining)] + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = EventSourceSuppressMessage)] private unsafe void WriteEvent(int eventId, string arg1, string arg2, string arg3, string arg4) { fixed (char* arg1Ptr = arg1) diff --git a/sdk/servicebus/ci.yml b/sdk/servicebus/ci.yml index d7233f69bc286..8e85850c982ee 100644 --- a/sdk/servicebus/ci.yml +++ b/sdk/servicebus/ci.yml @@ -35,3 +35,7 @@ extends: Artifacts: - name: Azure.Messaging.ServiceBus safeName: AzureMessagingServiceBus + CheckAotCompat: true + AOTTestInputs: + - ArtifactName: Azure.Messaging.ServiceBus + ExpectedWarningsFilepath: None