Skip to content

Commit a3bd662

Browse files
committed
Revert the workaround for < .NET Core 3.1
1 parent 675255f commit a3bd662

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncCachedStringsIntegration.cs

-11
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,12 @@ internal static CallTargetState OnMethodBegin<TTarget, TExchange, TRoutingKey, T
4141
return BasicPublishAsyncIntegration.OnMethodBegin(instance, exchangeString, routingKeyString, mandatory, basicProperties, body, default);
4242
}
4343

44-
#if NETCOREAPP3_1_OR_GREATER
4544
// We don't support ValueTask in < .NET Core 3.1, which means this doesn't work and is never called
4645
internal static TReturn? OnAsyncMethodEnd<TTarget, TReturn>(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state)
4746
{
4847
state.Scope.DisposeWithException(exception);
4948
return returnValue;
5049
}
51-
#else
52-
// If the method executes synchronously, then this works fine, but if it executes asynchronously we could miss the exception
53-
// This is because the exception is thrown after the method returns, and we can't catch it here
54-
// If/when we support handling ValueTask correctly in < .NET Core 3.1, we should remove this method
55-
internal static CallTargetReturn<TReturn?> OnMethodEnd<TTarget, TReturn>(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state)
56-
{
57-
state.Scope.DisposeWithException(exception);
58-
return new CallTargetReturn<TReturn?>(returnValue);
59-
}
60-
#endif
6150
}
6251

6352
/// <summary>

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/RabbitMQ/BasicPublishAsyncIntegration.cs

-11
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,10 @@ internal static CallTargetState OnMethodBegin<TTarget, TBasicProperties, TBody>(
6565
return new CallTargetState(scope);
6666
}
6767

68-
#if NETCOREAPP3_1_OR_GREATER
6968
// We don't support ValueTask in < .NET Core 3.1, which means this doesn't work and is never called
7069
internal static TReturn? OnAsyncMethodEnd<TTarget, TReturn>(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state)
7170
{
7271
state.Scope.DisposeWithException(exception);
7372
return returnValue;
7473
}
75-
#else
76-
// If the method executes synchronously, then this works fine, but if it executes asynchronously we could miss the exception
77-
// This is because the exception is thrown after the method returns, and we can't catch it here
78-
// If/when we support handling ValueTask correctly in < .NET Core 3.1, we should remove this method
79-
internal static CallTargetReturn<TReturn?> OnMethodEnd<TTarget, TReturn>(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state)
80-
{
81-
state.Scope.DisposeWithException(exception);
82-
return new CallTargetReturn<TReturn?>(returnValue);
83-
}
84-
#endif
8574
}

0 commit comments

Comments
 (0)