diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs index c77a15a1b..a7aa3f5cf 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs @@ -386,7 +386,7 @@ } -#if NETCOREAPP2_1 || NETCOREAPP3_1 +#if NETCOREAPP [TestMethod] public async Task SendAsyncLogsIngestionReponseTimeEventCounter() { @@ -425,9 +425,7 @@ // Max should be more than 30 ms, as we introduced a delay of 30ms in SendAsync. #if NETCOREAPP2_1 Assert.IsTrue((float)payload["Max"] >= 30); -#endif - -#if NETCOREAPP3_1 +#elif NETCOREAPP3_1 Assert.IsTrue((double)payload["Max"] >= 30); #endif } @@ -474,9 +472,7 @@ // Mean should be more than 30 ms, as we introduced a delay of 30ms in SendAsync. #if NETCOREAPP2_1 Assert.IsTrue((float)payload["Mean"] >= 30); -#endif - -#if NETCOREAPP3_1 +#elif NETCOREAPP3_1 Assert.IsTrue((double)payload["Mean"] >= 30); #endif } diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformImplementationTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformImplementationTest.cs index 4ceab905c..4db09cf36 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformImplementationTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformImplementationTest.cs @@ -1,6 +1,6 @@ namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform { -#if !NETCOREAPP +#if NETFRAMEWORK using System; using System.IO; using System.Security; diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformReferencesTests.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformReferencesTests.cs index 6d213079f..58b2a41ac 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformReferencesTests.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/Platform/PlatformReferencesTests.cs @@ -1,6 +1,6 @@ namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform { -#if !NETCOREAPP +#if NETFRAMEWORK using Microsoft.ApplicationInsights.DataContracts; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/RichPayloadEventSourceTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/RichPayloadEventSourceTest.cs index 2c5f083ce..8943015b4 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/RichPayloadEventSourceTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/Implementation/RichPayloadEventSourceTest.cs @@ -1,6 +1,6 @@ namespace Microsoft.ApplicationInsights.Extensibility.Implementation { -#if !NETCOREAPP +#if NETFRAMEWORK using System; using System.Collections.Generic; using System.Diagnostics.Tracing; diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/FailOnAssertSetup.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/FailOnAssertSetup.cs index 919ac2a18..2980b0b17 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/FailOnAssertSetup.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/FailOnAssertSetup.cs @@ -4,7 +4,7 @@ namespace Microsoft.ApplicationInsights { -#if !NETCOREAPP +#if NETFRAMEWORK using System; using System.Diagnostics; using System.Linq; diff --git a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/BackoffLogicManagerTest.cs b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/BackoffLogicManagerTest.cs index 036956efe..ca7bac941 100644 --- a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/BackoffLogicManagerTest.cs +++ b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/BackoffLogicManagerTest.cs @@ -94,7 +94,7 @@ [TestMethod] public void UpperBoundOfDelayIsMaxDelay() { -#if !NETCOREAPP +#if NETFRAMEWORK var manager = new BackoffLogicManager(TimeSpan.Zero, TimeSpan.Zero); PrivateObject wrapper = new PrivateObject(manager); diff --git a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/TelemetryBufferTest.cs b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/TelemetryBufferTest.cs index a4aefc1b5..204588760 100644 --- a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/TelemetryBufferTest.cs +++ b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/TelemetryBufferTest.cs @@ -30,7 +30,7 @@ AssertEx.Throws(() => new TelemetryBuffer(null, new StubApplicationLifecycle())); } -#if !NETCOREAPP +#if NETFRAMEWORK [TestMethod] public void ConstructorThrowsArgumentNullExceptionWhenApplicationLifecycleIsNull() { diff --git a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/WebApplicationLifecycleTest.cs b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/WebApplicationLifecycleTest.cs index 8e35a0a62..451b01a5c 100644 --- a/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/WebApplicationLifecycleTest.cs +++ b/BASE/Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Implementation/WebApplicationLifecycleTest.cs @@ -1,6 +1,6 @@ namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation { -#if !NETCOREAPP +#if NETFRAMEWORK using System; using System.Threading.Tasks; using System.Web.Hosting; diff --git a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/TelemetryConfigurationFactory.cs b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/TelemetryConfigurationFactory.cs index def79a28c..004f10af6 100644 --- a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/TelemetryConfigurationFactory.cs +++ b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/TelemetryConfigurationFactory.cs @@ -397,7 +397,7 @@ { instance = TimeSpan.Parse(valueString, CultureInfo.InvariantCulture); } -#if NET452 || NET46 +#if NETFRAMEWORK else if (expectedType.IsEnum) #else else if (expectedType.GetTypeInfo().IsEnum) diff --git a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Tracing/BaseDefaultHeartbeatPropertyProvider.cs b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Tracing/BaseDefaultHeartbeatPropertyProvider.cs index f9f801dc7..1e82c2da5 100644 --- a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Tracing/BaseDefaultHeartbeatPropertyProvider.cs +++ b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Tracing/BaseDefaultHeartbeatPropertyProvider.cs @@ -84,14 +84,14 @@ /// a string representing the version of the current .NET framework. private static string GetRuntimeFrameworkVer() { -#if NET452 || NET46 +#if NETFRAMEWORK Assembly assembly = typeof(Object).GetTypeInfo().Assembly; AssemblyFileVersionAttribute objectAssemblyFileVer = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute)) .Cast() .FirstOrDefault(); return objectAssemblyFileVer != null ? objectAssemblyFileVer.Version : "undefined"; -#elif NETSTANDARD2_0 +#elif NETSTANDARD return System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; #else #error Unrecognized framework @@ -127,11 +127,11 @@ private static string GetRuntimeOsType() { string osValue = "unknown"; -#if NET452 || NET46 +#if NETFRAMEWORK osValue = Environment.OSVersion.Platform.ToString(); -#elif NETSTANDARD2_0 +#elif NETSTANDARD if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { diff --git a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/WeakConcurrentRandom.cs b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/WeakConcurrentRandom.cs index e242872eb..eaad7bf3c 100644 --- a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/WeakConcurrentRandom.cs +++ b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/WeakConcurrentRandom.cs @@ -72,7 +72,7 @@ namespace Microsoft.ApplicationInsights.Extensibility.Implementation public static WeakConcurrentRandom Instance { -#if NET452 || NET46 +#if NETFRAMEWORK [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif get diff --git a/BASE/src/Microsoft.ApplicationInsights/PreciseTimestamp.cs b/BASE/src/Microsoft.ApplicationInsights/PreciseTimestamp.cs index 3508d6426..8730aada1 100644 --- a/BASE/src/Microsoft.ApplicationInsights/PreciseTimestamp.cs +++ b/BASE/src/Microsoft.ApplicationInsights/PreciseTimestamp.cs @@ -2,7 +2,7 @@ { using System; using System.Diagnostics; -#if NET452 || NET46 +#if NETFRAMEWORK using System.Diagnostics.CodeAnalysis; using System.Threading; #endif @@ -14,7 +14,7 @@ /// internal static readonly double StopwatchTicksToTimeSpanTicks = (double)TimeSpan.TicksPerSecond / Stopwatch.Frequency; -#if NET452 || NET46 +#if NETFRAMEWORK private static readonly Timer SyncTimeUpdater; private static TimeSync timeSync = new TimeSync(); @@ -30,7 +30,7 @@ /// public static DateTimeOffset GetUtcNow() { -#if NET452 || NET46 +#if NETFRAMEWORK // DateTime.UtcNow accuracy on .NET Framework is ~16ms, this method // uses combination of Stopwatch and DateTime to calculate accurate UtcNow. @@ -46,7 +46,7 @@ #endif } -#if NET452 || NET46 +#if NETFRAMEWORK private static void Sync() { // wait for DateTime.UtcNow update to the next granular value diff --git a/BASE/src/ServerTelemetryChannel/Implementation/ApplicationFolderProvider.cs b/BASE/src/ServerTelemetryChannel/Implementation/ApplicationFolderProvider.cs index 67af5cbd7..ac4eeb45b 100644 --- a/BASE/src/ServerTelemetryChannel/Implementation/ApplicationFolderProvider.cs +++ b/BASE/src/ServerTelemetryChannel/Implementation/ApplicationFolderProvider.cs @@ -262,7 +262,7 @@ { string baseDirectory = string.Empty; -#if !NETSTANDARD +#if NETFRAMEWORK baseDirectory = AppDomain.CurrentDomain.BaseDirectory; #else baseDirectory = AppContext.BaseDirectory; diff --git a/BASE/src/ServerTelemetryChannel/Implementation/TelemetryBuffer.cs b/BASE/src/ServerTelemetryChannel/Implementation/TelemetryBuffer.cs index 1081337e6..f472e210a 100644 --- a/BASE/src/ServerTelemetryChannel/Implementation/TelemetryBuffer.cs +++ b/BASE/src/ServerTelemetryChannel/Implementation/TelemetryBuffer.cs @@ -34,7 +34,7 @@ throw new ArgumentNullException(nameof(serializer)); } -#if !NETSTANDARD +#if NETFRAMEWORK // We don't have implementation for IApplicationLifecycle for .NET Core if (applicationLifecycle == null) { diff --git a/BASE/src/ServerTelemetryChannel/Implementation/WeakConcurrentRandom.cs b/BASE/src/ServerTelemetryChannel/Implementation/WeakConcurrentRandom.cs index 703ae08db..978c74d4e 100644 --- a/BASE/src/ServerTelemetryChannel/Implementation/WeakConcurrentRandom.cs +++ b/BASE/src/ServerTelemetryChannel/Implementation/WeakConcurrentRandom.cs @@ -66,7 +66,7 @@ public static WeakConcurrentRandom Instance { -#if NET452 || NET46 +#if NETFRAMEWORK [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif get diff --git a/BASE/src/ServerTelemetryChannel/Implementation/WebApplicationLifecycle.cs b/BASE/src/ServerTelemetryChannel/Implementation/WebApplicationLifecycle.cs index afc12907e..e9d39584b 100644 --- a/BASE/src/ServerTelemetryChannel/Implementation/WebApplicationLifecycle.cs +++ b/BASE/src/ServerTelemetryChannel/Implementation/WebApplicationLifecycle.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD +#if NETFRAMEWORK namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation { using System; diff --git a/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs b/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs index c78496e30..4d3b53988 100644 --- a/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs +++ b/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs @@ -31,7 +31,7 @@ /// /// Initializes a new instance of the class. /// -#if !NETSTANDARD +#if NETFRAMEWORK [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "WebApplicationLifecycle is needed for the life of the application.")] public ServerTelemetryChannel() : this(new Network(), new WebApplicationLifecycle()) #else @@ -45,7 +45,7 @@ { var policies = new TransmissionPolicy[] { -#if !NETSTANDARD +#if NETFRAMEWORK // We don't have implementation for IApplicationLifecycle for .NET Core new ApplicationLifecycleTransmissionPolicy(applicationLifecycle), #endif