diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncCachedStringsIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncCachedStringsIntegration.cs index b39256d17fd8..b774384bae50 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncCachedStringsIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncCachedStringsIntegration.cs @@ -41,23 +41,12 @@ internal static CallTargetState OnMethodBegin(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) { state.Scope.DisposeWithException(exception); return returnValue; } -#else - // If the method executes synchronously, then this works fine, but if it executes asynchronously we could miss the exception - // This is because the exception is thrown after the method returns, and we can't catch it here - // If/when we support handling ValueTask correctly in < .NET Core 3.1, we should remove this method - internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) - { - state.Scope.DisposeWithException(exception); - return new CallTargetReturn(returnValue); - } -#endif } /// diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncIntegration.cs index e2717885d6d9..24d2ca2afe30 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncIntegration.cs @@ -65,21 +65,10 @@ internal static CallTargetState OnMethodBegin( return new CallTargetState(scope); } -#if NETCOREAPP3_1_OR_GREATER // We don't support ValueTask in < .NET Core 3.1, which means this doesn't work and is never called internal static TReturn? OnAsyncMethodEnd(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) { state.Scope.DisposeWithException(exception); return returnValue; } -#else - // If the method executes synchronously, then this works fine, but if it executes asynchronously we could miss the exception - // This is because the exception is thrown after the method returns, and we can't catch it here - // If/when we support handling ValueTask correctly in < .NET Core 3.1, we should remove this method - internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) - { - state.Scope.DisposeWithException(exception); - return new CallTargetReturn(returnValue); - } -#endif }