remove netcoreapp2.1 from source (#2350)

* removing netcoreapp2.1 from source

* removing netcoreapp2.1 from source

* cleanup preprocessors
This commit is contained in:
Timothy Mothra 2021-08-04 11:47:24 -07:00 коммит произвёл GitHub
Родитель dc8c8b09ee
Коммит 561c624a96
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
25 изменённых файлов: 70 добавлений и 175 удалений

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

@ -423,9 +423,7 @@
Assert.AreEqual("IngestionEndpoint-ResponseTimeMsec", payload["Name"].ToString());
Assert.IsTrue((int)payload["Count"] >= 5);
// 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);
#elif NETCOREAPP3_1
#if NETCOREAPP
Assert.IsTrue((double)payload["Max"] >= 30);
#endif
}
@ -470,9 +468,7 @@
Assert.AreEqual("IngestionEndpoint-ResponseTimeMsec", payload["Name"].ToString());
Assert.IsTrue((int)payload["Count"] >= 5);
// 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);
#elif NETCOREAPP3_1
#if NETCOREAPP
Assert.IsTrue((double)payload["Mean"] >= 30);
#endif
}

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

@ -1,4 +1,4 @@
#if NET461 || NETCOREAPP2_1 || NETCOREAPP3_1 || NET5_0
#if NET461 || NETCOREAPP
namespace Microsoft.ApplicationInsights.TestFramework.Extensibility.Implementation.Authentication
{
using System;

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

@ -84,8 +84,6 @@
Assert.AreEqual(0, stackFrame.line);
}
#if !NETCOREAPP2_0
[TestMethod]
public void CheckThatFileNameAndLineAreCorrectIfAvailable()
{
@ -110,25 +108,6 @@
Assert.IsNull(stack[0].fileName);
}
}
#endif
#if NETCOREAPP2_0
[TestMethod]
public void CheckThatAssemblyNameHasCorrectValue()
{
var exp = this.CreateException(2);
ExceptionDetails expDetails = ExceptionConverter.ConvertToExceptionDetails(exp, null);
string assemblyFullName = Assembly.GetExecutingAssembly().FullName;
foreach (var stackFrame in expDetails.parsedStack)
{
Assert.AreEqual(assemblyFullName.ToLowerInvariant(), stackFrame.assembly.ToLowerInvariant());
}
}
#endif
[TestMethod]
public void CheckLevelCorrespondsToFrameForLongStack()

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

@ -1,6 +1,5 @@
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing
{
#if !NETCOREAPP2_0
using System;
using System.Globalization;
using System.Threading;
@ -45,5 +44,4 @@
}
}
}
#endif
}

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

@ -504,7 +504,7 @@
}
[TestMethod]
#if NETCOREAPP3_1 || NET5_0
#if NETCOREAPP
[ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'TimeSpanProperty' Reason: String 'TestValue' was not recognized as a valid TimeSpan.")]
#else
[ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'TimeSpanProperty' Reason: String was not recognized as a valid TimeSpan.")]

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

@ -30,7 +30,7 @@
Directory.Delete(this.tempPath, true);
}
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP3_1
[Ignore("Missing netstandard dependencies.")]
#endif
[TestMethod]

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

@ -1,4 +1,4 @@
#if NETCOREAPP2_1
#if NETCOREAPP
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System;
@ -47,6 +47,5 @@ namespace Microsoft.ApplicationInsights.WindowsServer.Channel.Helpers
}
}
}
}
#endif
#endif

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

@ -1,4 +1,4 @@
#if NET461 || NETCOREAPP2_1 || NETCOREAPP3_1 || NET5_0
#if NET461 || NETCOREAPP
namespace Microsoft.ApplicationInsights.TestFramework.Helpers
{
using System;

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

@ -61,7 +61,6 @@
// [TestMethod]
public void IsThreadSafe()
{
#if !NETCOREAPP2_1
const int NumberOfThreads = 16;
const int NumberOfFilesPerThread = 64;
var storage = new TransmissionStorage();
@ -94,7 +93,6 @@
{
}
}
#endif
}
}

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

@ -1,4 +1,4 @@
#if NETCOREAPP2_1
#if NETCOREAPP
namespace Microsoft.ApplicationInsights.WindowsServer.Channel
{
using System.Collections.Generic;

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

@ -34,6 +34,9 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Azure.Core" Version="1.14.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
</ItemGroup>
<Import Project="..\..\..\Test\TestFramework\Shared\TestFramework.Shared.projitems" Label="TestFramework.Shared" />

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

@ -33,10 +33,8 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
NETCORE\src\Shared\Shared.projitems*{079e8118-28b3-4567-a384-ea337a0ed9fb}*SharedItemsImports = 5
BASE\src\Common\Common\Common.projitems*{07f570e4-3a43-44d4-99a0-1d961b8e2a70}*SharedItemsImports = 5
WEB\Src\Common\Common.projitems*{33478fb4-05fc-4cbd-a04d-17d0d6ba5b13}*SharedItemsImports = 5
WEB\Src\Common\Common.projitems*{56c361c2-724c-4688-b4e1-f94c0681ec33}*SharedItemsImports = 5
BASE\src\Common\Common\Common.projitems*{893dfa71-0f4f-4bbf-ae8f-72208be237ba}*SharedItemsImports = 5
WEB\Src\Common\Common.projitems*{a8d39e66-af60-4f51-aedc-2464a2d86dea}*SharedItemsImports = 5
WEB\Src\PerformanceCollector\Perf.Shared.NetFull\Perf.Shared.NetFull.projitems*{a8d39e66-af60-4f51-aedc-2464a2d86dea}*SharedItemsImports = 5
LOGGING\src\CommonShared\CommonShared.projitems*{dd8682e9-bdcf-459b-b1a6-97966c3e9b6a}*SharedItemsImports = 5

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

@ -21,28 +21,29 @@
[Fact]
public void CorrelationInfoIsPropagatedToDependendedService()
{
#if netcoreapp2_0 // Correlation works on .Net core.
using (var server = new InProcessServer(assemblyName, this.output))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/");
task.Wait(TestTimeoutMs);
}
// TODO: THIS IS A TESTING GAP
//#if NETCOREAPP // Correlation works on .Net core.
// using (var server = new InProcessServer(assemblyName, this.output))
// {
// using (var httpClient = new HttpClient())
// {
// var task = httpClient.GetAsync(server.BaseHost + "/");
// task.Wait(TestTimeoutMs);
// }
var actual = server.Execute<Envelope>(() => server.Listener.ReceiveItems(2, TestListenerTimeoutInMs));
this.DebugTelemetryItems(actual);
// var actual = server.Execute<Envelope>(() => server.Listener.ReceiveItems(2, TestListenerTimeoutInMs));
// this.DebugTelemetryItems(actual);
var dependencyTelemetry = actual.OfType<TelemetryItem<RemoteDependencyData>>().FirstOrDefault();
Assert.NotNull(dependencyTelemetry);
// var dependencyTelemetry = actual.OfType<TelemetryItem<RemoteDependencyData>>().FirstOrDefault();
// Assert.NotNull(dependencyTelemetry);
var requestTelemetry = actual.OfType<TelemetryItem<RequestData>>().FirstOrDefault();
Assert.NotNull(requestTelemetry);
// var requestTelemetry = actual.OfType<TelemetryItem<RequestData>>().FirstOrDefault();
// Assert.NotNull(requestTelemetry);
Assert.Equal(requestTelemetry.tags["ai.operation.id"], dependencyTelemetry.tags["ai.operation.id"]);
Assert.Contains(dependencyTelemetry.tags["ai.operation.id"], requestTelemetry.tags["ai.operation.parentId"]);
}
#endif
// Assert.Equal(requestTelemetry.tags["ai.operation.id"], dependencyTelemetry.tags["ai.operation.id"]);
// Assert.Contains(dependencyTelemetry.tags["ai.operation.id"], requestTelemetry.tags["ai.operation.parentId"]);
// }
//#endif
}
}
}

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

@ -26,38 +26,39 @@
[Fact]
public void CorrelationInfoIsNotAddedToRequestHeaderIfUserAddDomainToExcludedList()
{
#if netcoreapp2_0 // Correlation is supported on .Net core.
using (var server = new InProcessServer(assemblyName, this.output))
{
var dependencyCollectorModule = server.ApplicationServices.GetServices<ITelemetryModule>().OfType<DependencyTrackingTelemetryModule>().Single();
dependencyCollectorModule.ExcludeComponentCorrelationHttpHeadersOnDomains.Add(server.BaseHost);
// TODO: THIS IS A TESTING GAP
//#if NETCOREAPP // Correlation is supported on .Net core.
// using (var server = new InProcessServer(assemblyName, this.output))
// {
// var dependencyCollectorModule = server.ApplicationServices.GetServices<ITelemetryModule>().OfType<DependencyTrackingTelemetryModule>().Single();
// dependencyCollectorModule.ExcludeComponentCorrelationHttpHeadersOnDomains.Add(server.BaseHost);
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/");
task.Wait(TestTimeoutMs);
}
// using (var httpClient = new HttpClient())
// {
// var task = httpClient.GetAsync(server.BaseHost + "/");
// task.Wait(TestTimeoutMs);
// }
var actual = server.Execute<Envelope>(() => server.Listener.ReceiveItems(TestListenerTimeoutInMs));
this.DebugTelemetryItems(actual);
// var actual = server.Execute<Envelope>(() => server.Listener.ReceiveItems(TestListenerTimeoutInMs));
// this.DebugTelemetryItems(actual);
try
{
var dependencyTelemetry = actual.OfType<TelemetryItem<RemoteDependencyData>>().FirstOrDefault();
Assert.NotNull(dependencyTelemetry);
// try
// {
// var dependencyTelemetry = actual.OfType<TelemetryItem<RemoteDependencyData>>().FirstOrDefault();
// Assert.NotNull(dependencyTelemetry);
var requestTelemetry = actual.OfType<TelemetryItem<RequestData>>().FirstOrDefault();
Assert.NotNull(requestTelemetry);
// var requestTelemetry = actual.OfType<TelemetryItem<RequestData>>().FirstOrDefault();
// Assert.NotNull(requestTelemetry);
Assert.NotEqual(requestTelemetry.tags["ai.operation.id"], dependencyTelemetry.tags["ai.operation.id"]);
}
catch (Exception e)
{
string data = DebugTelemetryItems(actual);
throw new Exception(data, e);
}
}
#endif
// Assert.NotEqual(requestTelemetry.tags["ai.operation.id"], dependencyTelemetry.tags["ai.operation.id"]);
// }
// catch (Exception e)
// {
// string data = DebugTelemetryItems(actual);
// throw new Exception(data, e);
// }
// }
//#endif
}
[Fact]

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

@ -13,16 +13,7 @@ namespace IntegrationTests.WebApp
{
public class Program
{
#if NETCOREAPP2_1
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup_netcoreapp_2_1>();
#elif NET5_0
#if NET5_0
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();

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

@ -1,60 +0,0 @@
#if NETCOREAPP2_1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace IntegrationTests.WebApp
{
public class Startup_netcoreapp_2_1
{
public Startup_netcoreapp_2_1(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseCookiePolicy();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
#endif

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

@ -488,6 +488,7 @@
}
else
{
// TODO: THIS IS A TESTING GAP
#if NETCOREAPP2_1
// even though we don't inject back-compatible request-id, .NET Core 2.0 will inject one that will look like traceparent
Assert.AreEqual(expectedTraceParentHeader, request.Headers.GetValues(RequestResponseHeaders.RequestIdHeader).Single());

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

@ -394,7 +394,7 @@
[TestMethod]
public void PerformanceCollectorModuleDefaultContainsExpectedCountersNonWindows()
{
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
PerformanceCounterUtility.isAzureWebApp = null;
var original = PerformanceCounterUtility.IsWindows;
PerformanceCounterUtility.IsWindows = false;
@ -458,7 +458,7 @@
{
PerformanceCounterUtility.isAzureWebApp = null;
var module = new PerformanceCollectorModule();
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
var original = PerformanceCounterUtility.IsWindows;
PerformanceCounterUtility.IsWindows = true;
#endif
@ -490,7 +490,7 @@
finally
{
module.Dispose();
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
PerformanceCounterUtility.IsWindows = original;
#endif
}

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

@ -1,4 +1,4 @@
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
namespace Microsoft.ApplicationInsights.Tests
{
using System;

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

@ -1,4 +1,4 @@
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
namespace Microsoft.ApplicationInsights.Tests
{
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.Implementation;

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

@ -18,11 +18,7 @@
try
{
var actual = PerformanceCounterUtility.GetPerformanceCollector();
#if NETCOREAPP2_0
Assert.AreEqual("StandardPerformanceCollector", actual.GetType().Name);
#else // NET452
Assert.AreEqual("StandardPerformanceCollector", actual.GetType().Name);
#endif
Assert.AreEqual("StandardPerformanceCollector", actual.GetType().Name);
}
finally
{
@ -51,7 +47,7 @@
[TestMethod]
public void GetCollectorReturnsXPlatformCollectorForWebAppForLinux()
{
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
var original = PerformanceCounterUtility.IsWindows;
try
{
@ -73,7 +69,7 @@
[TestMethod]
public void GetCollectorReturnsXPlatformCollectorForNonWindows()
{
#if NETCOREAPP2_1 || NETCOREAPP3_1
#if NETCOREAPP
var original = PerformanceCounterUtility.IsWindows;
try
{

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

@ -41,13 +41,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DependencyCollector.Tests",
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\..\BASE\src\Common\Common\Common.projitems*{37030556-260d-49b9-b546-72a44d0b2cb6}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{3d729610-dbc2-4cde-9969-cbdb93db6102}*SharedItemsImports = 5
..\..\Src\TestFramework\Shared\TestFramework.Shared.projitems*{444ad720-ea06-4aca-a7c4-06a3527a61be}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{4605eefe-6a7f-4568-a55c-5541d390b013}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{69638973-00ed-4468-85ce-548fe6bd859b}*SharedItemsImports = 5
..\..\Src\PerformanceCollector\Perf.Shared.NetFull\Perf.Shared.NetFull.projitems*{69638973-00ed-4468-85ce-548fe6bd859b}*SharedItemsImports = 5
..\..\..\BASE\src\Common\Common\Common.projitems*{b03d7034-2a49-4fe1-b9b1-4df16b136b2c}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{f68e18ca-00b6-4129-85a6-afc4ffe1ca9b}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution

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

@ -42,7 +42,7 @@
await ExecuteReaderAsyncInternal(connectionString, commandText, commandType);
}
#if !NETCOREAPP3_0 && !NETCOREAPP2_0
#if !NETCOREAPP
public static void BeginExecuteReader(string connectionString, string commandText, int numberOfAsyncArgs)
{
ManualResetEvent mre = new ManualResetEvent(false);

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

@ -30,8 +30,6 @@ Global
..\..\Src\Common\Common.projitems*{455a52da-0242-48ca-afb1-9566f1e0513a}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{685e146a-1541-4cfe-9fab-4f627979965e}*SharedItemsImports = 5
..\..\Src\PerformanceCollector\Perf.Shared.NetFull\Perf.Shared.NetFull.projitems*{685e146a-1541-4cfe-9fab-4f627979965e}*SharedItemsImports = 5
..\..\..\BASE\src\Common\Common\Common.projitems*{6d3a5a2f-e594-488b-bb4e-93fa0efba1e6}*SharedItemsImports = 5
..\..\..\BASE\src\Common\Common\Common.projitems*{bcbb6bd4-90cd-452e-81aa-c54b7f941053}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{e6045048-621c-476f-ac23-9a82afd56fe3}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{e9f6bf3e-3bd3-43f6-b4f1-4c84a0ceb340}*SharedItemsImports = 5
EndGlobalSection

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

@ -45,8 +45,6 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\Src\Common\Common.projitems*{00e2f973-3be4-4ae5-b3e9-21f97c45e5e7}*SharedItemsImports = 5
..\..\..\BASE\src\Common\Common\Common.projitems*{3a5be8ff-4571-48c0-bf28-5dbcb509900e}*SharedItemsImports = 5
..\..\..\BASE\src\Common\Common\Common.projitems*{4d3aed61-d670-4817-affd-91ecbe03fff2}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{5171849e-f678-4bb1-b3ca-9754e9d94821}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{634a3177-56b4-44b1-9c81-32ba3959eaa5}*SharedItemsImports = 5
..\..\Src\Common\Common.projitems*{a73a7554-a7af-451d-b611-2f98a6259d79}*SharedItemsImports = 5