Standardize conditional compilation (#2143)
This commit is contained in:
parent
9dedd85aea
commit
f857312cf9
|
@ -43,7 +43,7 @@ internal static class ContinuationsHelper
|
|||
return typeof(object);
|
||||
}
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
#if NETFRAMEWORK
|
||||
internal static TTo Convert<TFrom, TTo>(TFrom value)
|
||||
{
|
||||
return Converter<TFrom, TTo>.Convert(value);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public static class LoggingBuilderIntegration
|
|||
/// <returns>A default CallTargetReturn to satisfy the CallTarget contract</returns>
|
||||
internal static CallTargetReturn OnMethodEnd<TTarget>(TTarget instance, Exception exception, CallTargetState state)
|
||||
{
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
if (instance is not null)
|
||||
{
|
||||
var logBuilderExtensionsType = Type.GetType("OpenTelemetry.AutoInstrumentation.Logger.LogBuilderExtensions, OpenTelemetry.AutoInstrumentation");
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace OpenTelemetry.AutoInstrumentation.Instrumentations.MySqlData;
|
|||
type: InstrumentationType.Trace)]
|
||||
public static class MySqlConnectionStringBuilderIntegration
|
||||
{
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
private static readonly object TrueAsObject = true;
|
||||
#endif
|
||||
|
||||
|
@ -49,7 +49,7 @@ public static class MySqlConnectionStringBuilderIntegration
|
|||
internal static CallTargetReturn<TReturn> OnMethodEnd<TTarget, TReturn>(TReturn returnValue, Exception exception, CallTargetState state)
|
||||
where TTarget : struct
|
||||
{
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
var alwaysReturnTrue = (TReturn)TrueAsObject;
|
||||
|
||||
return new CallTargetReturn<TReturn>(alwaysReturnTrue);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using IntegrationTests.Helpers;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using IntegrationTests.Helpers;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using IntegrationTests.Helpers;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Threading.Tasks;
|
||||
using DotNet.Testcontainers.Builders;
|
||||
using DotNet.Testcontainers.Containers;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if NET6_0_OR_GREATER
|
||||
using IntegrationTests.Helpers;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
|
|
@ -144,7 +144,7 @@ public class SmokeTests : TestHelper
|
|||
collector.ResourceExpector.AssertExpectations();
|
||||
}
|
||||
|
||||
#if !NETFRAMEWORK // The feature is not supported on .NET Framework
|
||||
#if NET6_0_OR_GREATER // The feature is not supported on .NET Framework
|
||||
[Fact]
|
||||
[Trait("Category", "EndToEnd")]
|
||||
public void LogsResource()
|
||||
|
@ -196,7 +196,7 @@ public class SmokeTests : TestHelper
|
|||
collector.AssertExpectations();
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK // The test is flaky on Linux and macOS, becasue of https://github.com/dotnet/runtime/issues/28658#issuecomment-462062760
|
||||
#if NETFRAMEWORK // The test is flaky on Linux and macOS, because of https://github.com/dotnet/runtime/issues/28658#issuecomment-462062760
|
||||
[Fact]
|
||||
[Trait("Category", "EndToEnd")]
|
||||
public void PrometheusExporter()
|
||||
|
@ -245,7 +245,7 @@ public class SmokeTests : TestHelper
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !NETFRAMEWORK // The feature is not supported on .NET Framework
|
||||
#if NET6_0_OR_GREATER // The feature is not supported on .NET Framework
|
||||
[Fact]
|
||||
[Trait("Category", "EndToEnd")]
|
||||
public void SubmitLogs()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// limitations under the License.
|
||||
// </copyright>
|
||||
|
||||
#if NET462
|
||||
#if NETFRAMEWORK
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace IntegrationTests;
|
||||
|
|
Loading…
Reference in New Issue