Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
This commit is contained in:
Timothy Mothra 2021-06-02 13:47:08 -07:00 коммит произвёл GitHub
Родитель 53a4422d01
Коммит 8b4461b2cd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
17 изменённых файлов: 26 добавлений и 30 удалений

Просмотреть файл

@ -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
}

Просмотреть файл

@ -1,6 +1,6 @@
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
#if !NETCOREAPP
#if NETFRAMEWORK
using System;
using System.IO;
using System.Security;

Просмотреть файл

@ -1,6 +1,6 @@
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
#if !NETCOREAPP
#if NETFRAMEWORK
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Просмотреть файл

@ -1,6 +1,6 @@
namespace Microsoft.ApplicationInsights.Extensibility.Implementation
{
#if !NETCOREAPP
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;

Просмотреть файл

@ -4,7 +4,7 @@
namespace Microsoft.ApplicationInsights
{
#if !NETCOREAPP
#if NETFRAMEWORK
using System;
using System.Diagnostics;
using System.Linq;

Просмотреть файл

@ -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);

Просмотреть файл

@ -30,7 +30,7 @@
AssertEx.Throws<ArgumentNullException>(() => new TelemetryBuffer(null, new StubApplicationLifecycle()));
}
#if !NETCOREAPP
#if NETFRAMEWORK
[TestMethod]
public void ConstructorThrowsArgumentNullExceptionWhenApplicationLifecycleIsNull()
{

Просмотреть файл

@ -1,6 +1,6 @@
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
#if !NETCOREAPP
#if NETFRAMEWORK
using System;
using System.Threading.Tasks;
using System.Web.Hosting;

Просмотреть файл

@ -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)

Просмотреть файл

@ -84,14 +84,14 @@
/// <returns>a string representing the version of the current .NET framework.</returns>
private static string GetRuntimeFrameworkVer()
{
#if NET452 || NET46
#if NETFRAMEWORK
Assembly assembly = typeof(Object).GetTypeInfo().Assembly;
AssemblyFileVersionAttribute objectAssemblyFileVer =
assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute))
.Cast<AssemblyFileVersionAttribute>()
.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))
{

Просмотреть файл

@ -72,7 +72,7 @@ namespace Microsoft.ApplicationInsights.Extensibility.Implementation
public static WeakConcurrentRandom Instance
{
#if NET452 || NET46
#if NETFRAMEWORK
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
get

Просмотреть файл

@ -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 @@
/// </summary>
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 @@
/// </summary>
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

Просмотреть файл

@ -262,7 +262,7 @@
{
string baseDirectory = string.Empty;
#if !NETSTANDARD
#if NETFRAMEWORK
baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
#else
baseDirectory = AppContext.BaseDirectory;

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -66,7 +66,7 @@
public static WeakConcurrentRandom Instance
{
#if NET452 || NET46
#if NETFRAMEWORK
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
get

Просмотреть файл

@ -1,4 +1,4 @@
#if !NETSTANDARD
#if NETFRAMEWORK
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
using System;

Просмотреть файл

@ -31,7 +31,7 @@
/// <summary>
/// Initializes a new instance of the <see cref="ServerTelemetryChannel"/> class.
/// </summary>
#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