From a3448eba65f7daf47a6bbdafb3c19d7e0f031cb6 Mon Sep 17 00:00:00 2001 From: Jon Armen Date: Mon, 4 Apr 2022 12:57:34 -0400 Subject: [PATCH] update net45 to net462 --- .github/workflows/ci.yml | 2 +- sdk/Directory.Build.props | 2 +- sdk/src/Core/AWSXRayRecorder.Core.csproj | 14 +++++------ sdk/src/Core/AWSXRayRecorderImpl.cs | 10 ++++---- sdk/src/Core/AwsXrayRecorderBuilder.cs | 4 ++-- ...s => CallContextContainer.netframework.cs} | 2 +- .../Internal/Context/DefaultTraceContext.cs | 2 +- ...=> HybridContextContainer.netframework.cs} | 2 +- .../Internal/Emitters/UdpSegmentEmitter.cs | 2 +- ...s.net45.cs => AppSettings.netframework.cs} | 0 .../DynamicSegmentNamingStrategy.cs | 4 ++-- .../Strategies/FixedSegmentNamingStrategy.cs | 4 ++-- .../Core/Strategies/SegmentNamingStrategy.cs | 4 ++-- .../AWSXRayRecorder.Handlers.AspNet.csproj | 4 ++-- .../AWSXRayRecorder.Handlers.AwsSdk.csproj | 4 ++-- ...ayRecorder.Handlers.EntityFramework.csproj | 6 ++--- ...net45.cs => EFInterceptor.netframework.cs} | 2 +- sdk/src/Handlers/EntityFramework/EFUtil.cs | 4 ++-- .../AWSXRayRecorder.Handlers.SqlServer.csproj | 6 ++--- .../SqlServer/DbCommandInterceptor.cs | 2 +- ...cs => TraceableSqlCommand.netframework.cs} | 2 +- ...AWSXRayRecorder.Handlers.System.Net.csproj | 2 +- .../AWSXRayRecorder.IntegrationTests.csproj | 8 +++---- sdk/test/IntegrationTests/TestBase.cs | 2 +- .../IntegrationTests/ValidateSegmentTests.cs | 10 ++++---- .../AWSXRayRecorder.SmokeTests.csproj | 12 ++++------ sdk/test/UnitTests/AWSSDKHandlerTests.cs | 22 ++++++++--------- .../AWSXRayRecorder.UnitTests.csproj | 16 +++++-------- .../UnitTests/AWSXRayRecorderBuilderTests.cs | 18 +++++++------- sdk/test/UnitTests/AWSXRayRecorderTests.cs | 24 +++++++++---------- sdk/test/UnitTests/CauseTest.cs | 2 +- .../UnitTests/DbCommandInterceptorTests.cs | 20 ++++++++-------- .../HttpClientXRayTracingHandlerTests.cs | 6 ++--- .../HttpWebRequestTracingExtensionTests.cs | 10 ++++---- .../LocalizedSamplingStrategyTests.cs | 14 +++++------ .../UnitTests/SegmentNamingStrategyTests.cs | 6 ++--- sdk/test/UnitTests/SegmentTests.cs | 2 +- sdk/test/UnitTests/Tools/CustomResponses.cs | 2 +- sdk/test/UnitTests/Tools/MockWebResponse.cs | 2 +- 39 files changed, 126 insertions(+), 134 deletions(-) rename sdk/src/Core/Internal/Context/{CallContextContainer.net45.cs => CallContextContainer.netframework.cs} (97%) rename sdk/src/Core/Internal/Context/{HybridContextContainer.net45.cs => HybridContextContainer.netframework.cs} (98%) rename sdk/src/Core/Internal/Utils/{AppSettings.net45.cs => AppSettings.netframework.cs} (100%) rename sdk/src/Handlers/EntityFramework/{EFInterceptor.net45.cs => EFInterceptor.netframework.cs} (98%) rename sdk/src/Handlers/SqlServer/{TraceableSqlCommand.net45.cs => TraceableSqlCommand.netframework.cs} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d098c9a..adbc83f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - version: [net452, netcoreapp2.0, netcoreapp3.1] + version: [net462, netcoreapp2.0, netcoreapp3.1] steps: - name: Checkout repository diff --git a/sdk/Directory.Build.props b/sdk/Directory.Build.props index 79609b15..3a81156d 100644 --- a/sdk/Directory.Build.props +++ b/sdk/Directory.Build.props @@ -4,7 +4,7 @@ - + portable \ No newline at end of file diff --git a/sdk/src/Core/AWSXRayRecorder.Core.csproj b/sdk/src/Core/AWSXRayRecorder.Core.csproj index 49a169f8..343f6f6f 100644 --- a/sdk/src/Core/AWSXRayRecorder.Core.csproj +++ b/sdk/src/Core/AWSXRayRecorder.Core.csproj @@ -1,7 +1,7 @@  - net45;netstandard2.0;netcoreapp3.1 + net462;netstandard2.0;netcoreapp3.1 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -51,14 +51,14 @@ - - - - + + + + - + @@ -67,7 +67,7 @@ - + diff --git a/sdk/src/Core/AWSXRayRecorderImpl.cs b/sdk/src/Core/AWSXRayRecorderImpl.cs index 6ad0d6a1..0a69a416 100644 --- a/sdk/src/Core/AWSXRayRecorderImpl.cs +++ b/sdk/src/Core/AWSXRayRecorderImpl.cs @@ -37,7 +37,7 @@ namespace Amazon.XRay.Recorder.Core public abstract class AWSXRayRecorderImpl : IAWSXRayRecorder { private static readonly Logger _logger = Logger.GetLogger(typeof(AWSXRayRecorderImpl)); -#if NET45 +#if NETFRAMEWORK private static Lazy _lazyDefaultRecorder = new Lazy(() => AWSXRayRecorderBuilder.GetDefaultBuilder().Build()); protected static Lazy LazyDefaultRecorder { @@ -151,7 +151,7 @@ public ContextMissingStrategy ContextMissingStrategy /// The argument has a null value. public void BeginSegment(string name, string traceId = null, string parentId = null, SamplingResponse samplingResponse = null, DateTime? timestamp = null) { -#if !NET45 +#if !NETFRAMEWORK if (AWSXRayRecorder.IsLambda()) { throw new UnsupportedOperationException("Cannot override Facade Segment. New segment not created."); @@ -193,7 +193,7 @@ public void BeginSegment(string name, string traceId = null, string parentId = n /// Entity is not available in trace context. public void EndSegment(DateTime? timestamp = null) { -#if !NET45 +#if !NETFRAMEWORK if (AWSXRayRecorder.IsLambda()) { throw new UnsupportedOperationException("Cannot override Facade Segment. New segment not created."); @@ -727,7 +727,7 @@ protected void PopulateContexts() // Prepare XRay section for runtime context var xrayContext = new ConcurrentDictionary(); -#if NET45 +#if NETFRAMEWORK xrayContext["sdk"] = "X-Ray for .NET"; #else xrayContext["sdk"] = "X-Ray for .NET Core"; @@ -743,7 +743,7 @@ protected void PopulateContexts() } RuntimeContext["xray"] = xrayContext; -#if NET45 +#if NETFRAMEWORK ServiceContext["runtime"] = ".NET Framework"; #else ServiceContext["runtime"] = ".NET Core Framework"; diff --git a/sdk/src/Core/AwsXrayRecorderBuilder.cs b/sdk/src/Core/AwsXrayRecorderBuilder.cs index 9557e125..e59c61cd 100644 --- a/sdk/src/Core/AwsXrayRecorderBuilder.cs +++ b/sdk/src/Core/AwsXrayRecorderBuilder.cs @@ -56,7 +56,7 @@ public IReadOnlyList Plugins } } -#if NET45 +#if NETFRAMEWORK /// /// Initializes instance with default settings. /// @@ -67,7 +67,7 @@ public static AWSXRayRecorderBuilder GetDefaultBuilder() } #endif -#if NET45 +#if NETFRAMEWORK /// /// Reads plugin settings from app settings, and adds new instance of each plugin into the builder. /// If the plugin settings doesn't exist or the value of the settings is invalid, nothing will be added. diff --git a/sdk/src/Core/Internal/Context/CallContextContainer.net45.cs b/sdk/src/Core/Internal/Context/CallContextContainer.netframework.cs similarity index 97% rename from sdk/src/Core/Internal/Context/CallContextContainer.net45.cs rename to sdk/src/Core/Internal/Context/CallContextContainer.netframework.cs index d92cc770..3f4151a1 100644 --- a/sdk/src/Core/Internal/Context/CallContextContainer.net45.cs +++ b/sdk/src/Core/Internal/Context/CallContextContainer.netframework.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// +// // Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/sdk/src/Core/Internal/Context/DefaultTraceContext.cs b/sdk/src/Core/Internal/Context/DefaultTraceContext.cs index f0dc2fe5..ad4a85d5 100644 --- a/sdk/src/Core/Internal/Context/DefaultTraceContext.cs +++ b/sdk/src/Core/Internal/Context/DefaultTraceContext.cs @@ -25,7 +25,7 @@ public static class DefaultTraceContext /// default instance of public static ITraceContext GetTraceContext() { -#if NET45 +#if NETFRAMEWORK return new CallContextContainer(); #else if (AWSXRayRecorder.IsLambda()) diff --git a/sdk/src/Core/Internal/Context/HybridContextContainer.net45.cs b/sdk/src/Core/Internal/Context/HybridContextContainer.netframework.cs similarity index 98% rename from sdk/src/Core/Internal/Context/HybridContextContainer.net45.cs rename to sdk/src/Core/Internal/Context/HybridContextContainer.netframework.cs index 6012b1ab..629786bb 100644 --- a/sdk/src/Core/Internal/Context/HybridContextContainer.net45.cs +++ b/sdk/src/Core/Internal/Context/HybridContextContainer.netframework.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// +// // Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/sdk/src/Core/Internal/Emitters/UdpSegmentEmitter.cs b/sdk/src/Core/Internal/Emitters/UdpSegmentEmitter.cs index f312f046..2b55cff0 100644 --- a/sdk/src/Core/Internal/Emitters/UdpSegmentEmitter.cs +++ b/sdk/src/Core/Internal/Emitters/UdpSegmentEmitter.cs @@ -136,7 +136,7 @@ protected virtual void Dispose(bool disposing) { if (_udpClient != null) { -#if NET45 +#if NETFRAMEWORK _udpClient.Close(); #else _udpClient.Dispose(); diff --git a/sdk/src/Core/Internal/Utils/AppSettings.net45.cs b/sdk/src/Core/Internal/Utils/AppSettings.netframework.cs similarity index 100% rename from sdk/src/Core/Internal/Utils/AppSettings.net45.cs rename to sdk/src/Core/Internal/Utils/AppSettings.netframework.cs diff --git a/sdk/src/Core/Strategies/DynamicSegmentNamingStrategy.cs b/sdk/src/Core/Strategies/DynamicSegmentNamingStrategy.cs index 3fec0aa7..6d9e5f60 100644 --- a/sdk/src/Core/Strategies/DynamicSegmentNamingStrategy.cs +++ b/sdk/src/Core/Strategies/DynamicSegmentNamingStrategy.cs @@ -20,7 +20,7 @@ using System.Text.RegularExpressions; using Amazon.Runtime.Internal.Util; using Amazon.XRay.Recorder.Core.Internal.Utils; -#if NET45 +#if NETFRAMEWORK using System.Net.Http; #else using Microsoft.AspNetCore.Http; @@ -80,7 +80,7 @@ public DynamicSegmentNamingStrategy(string fallbackSegmentName, string hostNameP /// public string FallbackSegmentName { get; set; } -#if NET45 +#if NETFRAMEWORK /// /// Gets the name of the segment. /// diff --git a/sdk/src/Core/Strategies/FixedSegmentNamingStrategy.cs b/sdk/src/Core/Strategies/FixedSegmentNamingStrategy.cs index d7f5f3b8..06f857b5 100644 --- a/sdk/src/Core/Strategies/FixedSegmentNamingStrategy.cs +++ b/sdk/src/Core/Strategies/FixedSegmentNamingStrategy.cs @@ -18,7 +18,7 @@ using System; using Amazon.Runtime.Internal.Util; -#if NET45 +#if NETFRAMEWORK using System.Net.Http; #else using Microsoft.AspNetCore.Http; @@ -60,7 +60,7 @@ public FixedSegmentNamingStrategy(string fixedName) /// public string FixedName { get; set; } -#if NET45 +#if NETFRAMEWORK /// /// Gets the name of the segment. /// diff --git a/sdk/src/Core/Strategies/SegmentNamingStrategy.cs b/sdk/src/Core/Strategies/SegmentNamingStrategy.cs index 57f44090..aa63d227 100644 --- a/sdk/src/Core/Strategies/SegmentNamingStrategy.cs +++ b/sdk/src/Core/Strategies/SegmentNamingStrategy.cs @@ -18,7 +18,7 @@ using System; -#if NET45 +#if NETFRAMEWORK using System.Net.Http; #else using Microsoft.AspNetCore.Http; @@ -45,7 +45,7 @@ public static string GetSegmentNameFromEnvironmentVariable() return Environment.GetEnvironmentVariable(SegmentNamingStrategy.EnvironmentVariableSegmentName); } -#if NET45 +#if NETFRAMEWORK /// /// Gets the name of the segment. /// diff --git a/sdk/src/Handlers/AspNet/AWSXRayRecorder.Handlers.AspNet.csproj b/sdk/src/Handlers/AspNet/AWSXRayRecorder.Handlers.AspNet.csproj index 5644af64..9f8f6b87 100644 --- a/sdk/src/Handlers/AspNet/AWSXRayRecorder.Handlers.AspNet.csproj +++ b/sdk/src/Handlers/AspNet/AWSXRayRecorder.Handlers.AspNet.csproj @@ -1,7 +1,7 @@  - net45 + net462 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -33,7 +33,7 @@ - + diff --git a/sdk/src/Handlers/AwsSdk/AWSXRayRecorder.Handlers.AwsSdk.csproj b/sdk/src/Handlers/AwsSdk/AWSXRayRecorder.Handlers.AwsSdk.csproj index 95d32ab4..12bc3585 100644 --- a/sdk/src/Handlers/AwsSdk/AWSXRayRecorder.Handlers.AwsSdk.csproj +++ b/sdk/src/Handlers/AwsSdk/AWSXRayRecorder.Handlers.AwsSdk.csproj @@ -1,7 +1,7 @@  - net45;netstandard2.0 + net462;netstandard2.0 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -37,7 +37,7 @@ - + diff --git a/sdk/src/Handlers/EntityFramework/AWSXRayRecorder.Handlers.EntityFramework.csproj b/sdk/src/Handlers/EntityFramework/AWSXRayRecorder.Handlers.EntityFramework.csproj index ca9b4cba..c1946d5c 100644 --- a/sdk/src/Handlers/EntityFramework/AWSXRayRecorder.Handlers.EntityFramework.csproj +++ b/sdk/src/Handlers/EntityFramework/AWSXRayRecorder.Handlers.EntityFramework.csproj @@ -1,7 +1,7 @@ - net45;netstandard2.0 + net462;netstandard2.0 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -33,10 +33,10 @@ - + - + diff --git a/sdk/src/Handlers/EntityFramework/EFInterceptor.net45.cs b/sdk/src/Handlers/EntityFramework/EFInterceptor.netframework.cs similarity index 98% rename from sdk/src/Handlers/EntityFramework/EFInterceptor.net45.cs rename to sdk/src/Handlers/EntityFramework/EFInterceptor.netframework.cs index 70825467..4d9937e4 100644 --- a/sdk/src/Handlers/EntityFramework/EFInterceptor.net45.cs +++ b/sdk/src/Handlers/EntityFramework/EFInterceptor.netframework.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// +// // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/sdk/src/Handlers/EntityFramework/EFUtil.cs b/sdk/src/Handlers/EntityFramework/EFUtil.cs index 74d49182..1aef6705 100644 --- a/sdk/src/Handlers/EntityFramework/EFUtil.cs +++ b/sdk/src/Handlers/EntityFramework/EFUtil.cs @@ -20,7 +20,7 @@ using System.Text.RegularExpressions; using Amazon.Runtime.Internal.Util; using Amazon.XRay.Recorder.Core; -#if NET45 +#if NETFRAMEWORK using Amazon.XRay.Recorder.Core.Internal.Utils; #endif @@ -191,7 +191,7 @@ private static string RemovePortNumberFromDataSource(string dataSource) return _portNumberRegex.Replace(dataSource, string.Empty); } -#if !NET45 +#if !NETFRAMEWORK private static bool ShouldCollectSqlText(bool? collectSqlQueriesOverride) => collectSqlQueriesOverride ?? _recorder.XRayOptions.CollectSqlQueries; #else diff --git a/sdk/src/Handlers/SqlServer/AWSXRayRecorder.Handlers.SqlServer.csproj b/sdk/src/Handlers/SqlServer/AWSXRayRecorder.Handlers.SqlServer.csproj index b21bd430..477ef3ca 100644 --- a/sdk/src/Handlers/SqlServer/AWSXRayRecorder.Handlers.SqlServer.csproj +++ b/sdk/src/Handlers/SqlServer/AWSXRayRecorder.Handlers.SqlServer.csproj @@ -1,7 +1,7 @@  - net45;netstandard2.0 + net462;netstandard2.0 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -33,8 +33,8 @@ - - + + diff --git a/sdk/src/Handlers/SqlServer/DbCommandInterceptor.cs b/sdk/src/Handlers/SqlServer/DbCommandInterceptor.cs index 451eea75..7bc82631 100644 --- a/sdk/src/Handlers/SqlServer/DbCommandInterceptor.cs +++ b/sdk/src/Handlers/SqlServer/DbCommandInterceptor.cs @@ -150,7 +150,7 @@ protected virtual void CollectSqlInformation(DbCommand command) private string BuildSubsegmentName(DbCommand command) => command.Connection.Database + "@" + SqlUtil.RemovePortNumberFromDataSource(command.Connection.DataSource); -#if !NET45 +#if !NETFRAMEWORK private bool ShouldCollectSqlText() => _collectSqlQueriesOverride ?? _recorder.XRayOptions.CollectSqlQueries; #else diff --git a/sdk/src/Handlers/SqlServer/TraceableSqlCommand.net45.cs b/sdk/src/Handlers/SqlServer/TraceableSqlCommand.netframework.cs similarity index 99% rename from sdk/src/Handlers/SqlServer/TraceableSqlCommand.net45.cs rename to sdk/src/Handlers/SqlServer/TraceableSqlCommand.netframework.cs index e86705ff..b7923df6 100644 --- a/sdk/src/Handlers/SqlServer/TraceableSqlCommand.net45.cs +++ b/sdk/src/Handlers/SqlServer/TraceableSqlCommand.netframework.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// +// // Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/sdk/src/Handlers/System.Net/AWSXRayRecorder.Handlers.System.Net.csproj b/sdk/src/Handlers/System.Net/AWSXRayRecorder.Handlers.System.Net.csproj index 6801c864..ba95ec55 100644 --- a/sdk/src/Handlers/System.Net/AWSXRayRecorder.Handlers.System.Net.csproj +++ b/sdk/src/Handlers/System.Net/AWSXRayRecorder.Handlers.System.Net.csproj @@ -1,7 +1,7 @@  - net45;netstandard2.0 + net462;netstandard2.0 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/sdk/test/IntegrationTests/AWSXRayRecorder.IntegrationTests.csproj b/sdk/test/IntegrationTests/AWSXRayRecorder.IntegrationTests.csproj index 62e5fdd0..599f2e5e 100644 --- a/sdk/test/IntegrationTests/AWSXRayRecorder.IntegrationTests.csproj +++ b/sdk/test/IntegrationTests/AWSXRayRecorder.IntegrationTests.csproj @@ -2,7 +2,7 @@ - net45;netcoreapp2.0;netcoreapp3.1 + net462;netcoreapp2.0;netcoreapp3.1 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -21,9 +21,9 @@ - - - + + + diff --git a/sdk/test/IntegrationTests/TestBase.cs b/sdk/test/IntegrationTests/TestBase.cs index 4ae46606..9de2b73d 100644 --- a/sdk/test/IntegrationTests/TestBase.cs +++ b/sdk/test/IntegrationTests/TestBase.cs @@ -44,7 +44,7 @@ protected static void ClassCleanup() Recorder.Dispose(); } -#if NET45 +#if NETFRAMEWORK protected BatchGetTracesResponse BatchGetTraces(string traceId) { var request = new BatchGetTracesRequest(); diff --git a/sdk/test/IntegrationTests/ValidateSegmentTests.cs b/sdk/test/IntegrationTests/ValidateSegmentTests.cs index b63afae6..85becc1a 100644 --- a/sdk/test/IntegrationTests/ValidateSegmentTests.cs +++ b/sdk/test/IntegrationTests/ValidateSegmentTests.cs @@ -50,7 +50,7 @@ public void TestMinimalSegment() var segment = AWSXRayRecorder.Instance.TraceContext.GetEntity(); Thread.Sleep(100); Recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK var response = BatchGetTraces(traceId); #else var response = BatchGetTracesAsync(traceId).Result; @@ -80,7 +80,7 @@ public void TestMultipleSubsegments() AWSXRayRecorder.Instance.TraceContext.GetEntity().Subsegments.ForEach(x => subsegmentNames[x.Id] = x.Name); Recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK var response = BatchGetTraces(traceId); #else var response = BatchGetTracesAsync(traceId).Result; @@ -120,7 +120,7 @@ public void TestEC2Plugin() Thread.Sleep(100); recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK var response = BatchGetTraces(traceId); #else var response = BatchGetTracesAsync(traceId).Result; @@ -151,7 +151,7 @@ public void TestECSPlugin() recorder.BeginSegment(GetType().Name, traceId); Thread.Sleep(100); recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK var response = BatchGetTraces(traceId); #else var response = BatchGetTracesAsync(traceId).Result; @@ -182,7 +182,7 @@ public void TestElasticBeanstalkPlugin() recorder.BeginSegment(GetType().Name, traceId); Thread.Sleep(100); recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK var response = BatchGetTraces(traceId); #else var response = BatchGetTracesAsync(traceId).Result; diff --git a/sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj b/sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj index 15b0da58..00e2269c 100644 --- a/sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj +++ b/sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj @@ -1,7 +1,7 @@  - net452;netcoreapp2.0;netcoreapp3.1 + net462;netcoreapp2.0;netcoreapp3.1 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -11,15 +11,11 @@ true - - NET45 - - - + - - + + diff --git a/sdk/test/UnitTests/AWSSDKHandlerTests.cs b/sdk/test/UnitTests/AWSSDKHandlerTests.cs index 684a8267..f204fb89 100644 --- a/sdk/test/UnitTests/AWSSDKHandlerTests.cs +++ b/sdk/test/UnitTests/AWSSDKHandlerTests.cs @@ -44,7 +44,7 @@ public class AWSSDKHandlerTests : TestBase private AWSXRayRecorder _recorder; private static String _path = $"JSONs{Path.DirectorySeparatorChar}AWSRequestInfo.json"; -#if !NET45 +#if !NETFRAMEWORK private XRayOptions _xRayOptions = new XRayOptions(); #endif @@ -52,7 +52,7 @@ public class AWSSDKHandlerTests : TestBase public void TestInitialize() { _recorder = new AWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(recorder:_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -63,7 +63,7 @@ public void TestInitialize() public new void TestCleanup() { base.TestCleanup(); -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = null; AppSettings.Reset(); #else @@ -89,7 +89,7 @@ public void TestContextMissingStrategyForAWSSDKHandler() AWSXRayRecorder.Instance.EndSegment(); // The test should not break. No segment is available in the context, however, since the context missing strategy is log error, // no exception should be thrown by below code. -#if NET45 +#if NETFRAMEWORK dynamo.ListTables(); #else dynamo.ListTablesAsync().Wait(); @@ -105,7 +105,7 @@ public void TestS3SubsegmentNameIsCorrectForAWSSDKHandler() CustomResponses.SetResponse(s3, null, "TestAmazonId"); _recorder.BeginSegment("test s3", TraceId); -#if NET45 +#if NETFRAMEWORK s3.GetObject("testBucket", "testKey"); #else s3.GetObjectAsync("testBucket", "testKey").Wait(); @@ -131,7 +131,7 @@ public void TestDynamoDbClient() CustomResponses.SetResponse(client, requestId); _recorder.BeginSegment("test", TraceId); -#if NET45 +#if NETFRAMEWORK client.ListTables(); #else client.ListTablesAsync().Wait(); @@ -194,7 +194,7 @@ public void TestRequestResponseParameterAndDescriptorForAWSSDKHandler() var key2 = new Dictionary() { { "id", new AttributeValue("2") } }; var keys = new KeysAndAttributes() { Keys = new List>() { key1, key2 } }; -#if NET45 +#if NETFRAMEWORK client.BatchGetItem(new Dictionary() { { "test", keys } }); #else client.BatchGetItemAsync(new Dictionary() { { "test", keys } }).Wait(); @@ -259,7 +259,7 @@ public void TestDynamoSubsegmentNameIsCorrectForAWSSDKHandler() var dynamo = new AmazonDynamoDBClient(new AnonymousAWSCredentials(), RegionEndpoint.USEast1); CustomResponses.SetResponse(dynamo); _recorder.BeginSegment("test dynamo", TraceId); -#if NET45 +#if NETFRAMEWORK dynamo.ListTables(); #else dynamo.ListTablesAsync().Wait(); @@ -276,7 +276,7 @@ public void TestManifestFileNoLambda() //At this point, current manifest file do var lambda = new AmazonLambdaClient(new AnonymousAWSCredentials(), RegionEndpoint.USEast1); CustomResponses.SetResponse(lambda); _recorder.BeginSegment("lambda", TraceId); -#if NET45 +#if NETFRAMEWORK lambda.Invoke(new InvokeRequest { FunctionName = "testFunction" @@ -300,7 +300,7 @@ public void TestLambdaInvokeSubsegmentContainsFunctionNameForAWSSDKHandler() var lambda = new AmazonLambdaClient(new AnonymousAWSCredentials(), RegionEndpoint.USEast1); CustomResponses.SetResponse(lambda); _recorder.BeginSegment("lambda", TraceId); -#if NET45 +#if NETFRAMEWORK lambda.Invoke(new InvokeRequest { FunctionName = "testFunction" @@ -329,7 +329,7 @@ public void TestRegisterXRayManifestWithStreamLambdaForAWSSDKHandler() var lambda = new AmazonLambdaClient(new AnonymousAWSCredentials(), RegionEndpoint.USEast1); CustomResponses.SetResponse(lambda); _recorder.BeginSegment("lambda", TraceId); -#if NET45 +#if NETFRAMEWORK lambda.Invoke(new InvokeRequest { FunctionName = "testFunction" diff --git a/sdk/test/UnitTests/AWSXRayRecorder.UnitTests.csproj b/sdk/test/UnitTests/AWSXRayRecorder.UnitTests.csproj index 42c7300f..6cb27373 100644 --- a/sdk/test/UnitTests/AWSXRayRecorder.UnitTests.csproj +++ b/sdk/test/UnitTests/AWSXRayRecorder.UnitTests.csproj @@ -2,7 +2,7 @@ - net452;netcoreapp2.0;netcoreapp3.1 + net462;netcoreapp2.0;netcoreapp3.1 Amazon.com, Inc Amazon Web Service X-Ray Recorder Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -12,20 +12,16 @@ ../../../buildtools/local-development.snk - - + + TRACE;DEBUG 0618;1701;1702;1705 - + 0618;1701;1702;1705 - - NET45 - - TRACE;DEBUG 0618;1701;1702;1705 @@ -83,7 +79,7 @@ - + @@ -91,7 +87,7 @@ - + diff --git a/sdk/test/UnitTests/AWSXRayRecorderBuilderTests.cs b/sdk/test/UnitTests/AWSXRayRecorderBuilderTests.cs index 2348d97f..12afeeb0 100644 --- a/sdk/test/UnitTests/AWSXRayRecorderBuilderTests.cs +++ b/sdk/test/UnitTests/AWSXRayRecorderBuilderTests.cs @@ -32,7 +32,7 @@ using Amazon.Runtime; -#if !NET45 +#if !NETFRAMEWORK using Microsoft.Extensions.Configuration; #endif @@ -44,7 +44,7 @@ public class AwsXrayRecorderBuilderTests : TestBase private const string PluginKey = "AWSXRayPlugins"; private const string UseRuntimeErrors = "UseRuntimeErrors"; private AWSXRayRecorder _recorder; -#if !NET45 +#if !NETFRAMEWORK private XRayOptions _xRayOptions = new XRayOptions(); #endif [TestInitialize] @@ -57,7 +57,7 @@ public void Initialize() public new void TestCleanup() { base.TestCleanup(); -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[PluginKey] = null; ConfigurationManager.AppSettings[UseRuntimeErrors] = null; AppSettings.Reset(); @@ -91,7 +91,7 @@ public void TestBuildWithDummyPlugin() public void TestWithDefaultPlugins() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[PluginKey] = "EC2Plugin"; AppSettings.Reset(); AWSXRayRecorderBuilder builder = new AWSXRayRecorderBuilder().WithPluginsFromAppSettings(); @@ -109,7 +109,7 @@ public void TestWithDefaultPlugins() [TestMethod] public void TestPluginSettingMissing() { -#if NET45 +#if NETFRAMEWORK var builder = new AWSXRayRecorderBuilder().WithPluginsFromAppSettings(); #else var builder = new AWSXRayRecorderBuilder().WithPluginsFromConfig(_xRayOptions); @@ -120,7 +120,7 @@ public void TestPluginSettingMissing() [TestMethod] public void TestInvalidPluginSetting() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[PluginKey] = "UnknownPlugin, IPlugin"; AppSettings.Reset(); AWSXRayRecorderBuilder builder = new AWSXRayRecorderBuilder().WithPluginsFromAppSettings(); @@ -162,7 +162,7 @@ public void TestSetContextMissingStrategy() [TestMethod] public void TestSetContextMissingUsingConfiguration1() // Contextmissing startegy set to log error from configuration { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[UseRuntimeErrors] = "false"; AppSettings.Reset(); AWSXRayRecorderBuilder builder = new AWSXRayRecorderBuilder().WithContextMissingStrategyFromAppSettings(); @@ -177,7 +177,7 @@ public void TestSetContextMissingUsingConfiguration1() // Contextmissing starteg [TestMethod] public void TestSetContextMissingUsingConfiguration2() // Contextmissing startegy not set { -#if NET45 +#if NETFRAMEWORK AppSettings.Reset(); AWSXRayRecorderBuilder builder = new AWSXRayRecorderBuilder().WithContextMissingStrategyFromAppSettings(); #else @@ -191,7 +191,7 @@ public void TestSetContextMissingUsingConfiguration2() // Contextmissing starteg public void TestSetContextMissingUsingConfiguration3() // Contextmissing startegy is set through environment and configurations { Environment.SetEnvironmentVariable(AWSXRayRecorder.EnvironmentVariableContextMissingStrategy, "LOG_ERROR"); -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[UseRuntimeErrors] = "true"; AppSettings.Reset(); AWSXRayRecorderBuilder builder = new AWSXRayRecorderBuilder().WithContextMissingStrategyFromAppSettings(); diff --git a/sdk/test/UnitTests/AWSXRayRecorderTests.cs b/sdk/test/UnitTests/AWSXRayRecorderTests.cs index 54871163..fa989927 100644 --- a/sdk/test/UnitTests/AWSXRayRecorderTests.cs +++ b/sdk/test/UnitTests/AWSXRayRecorderTests.cs @@ -43,7 +43,7 @@ public class AwsXrayRecorderTests : TestBase { private const string DisableXRayTracingKey = "DisableXRayTracing"; private AWSXRayRecorder _recorder; -#if !NET45 +#if !NETFRAMEWORK private XRayOptions _xRayOptions = new XRayOptions(); #endif @@ -57,7 +57,7 @@ public void Initialize() public new void TestCleanup() { base.TestCleanup(); -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[DisableXRayTracingKey] = string.Empty; AppSettings.Reset(); @@ -722,7 +722,7 @@ public void TestOverwriteSqlInformationKey() [TestMethod] public void TestDisableXRayTracingAndNoSegmentSent() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[DisableXRayTracingKey] = "true"; AppSettings.Reset(); #else @@ -730,12 +730,12 @@ public void TestDisableXRayTracingAndNoSegmentSent() #endif Mock mockSegmentEmitter = new Mock(); -#if NET45 +#if NETFRAMEWORK AppSettings.Reset(); #endif using (var recorder = AWSXRayRecorderFactory.CreateAWSXRayRecorder(mockSegmentEmitter.Object)) { -#if !NET45 +#if !NETFRAMEWORK recorder.XRayOptions = _xRayOptions; #endif recorder.BeginSegment("test", TraceId); @@ -775,7 +775,7 @@ public void TestXrayContext() .ProductVersion; Assert.AreEqual(versionText, xray["sdk_version"]); -#if NET45 +#if NETFRAMEWORK Assert.AreEqual("X-Ray for .NET", xray["sdk"]); #else Assert.AreEqual("X-Ray for .NET Core", xray["sdk"]); @@ -788,7 +788,7 @@ public void TestServiceContext() _recorder.BeginSegment("test", TraceId); var segment = (Segment)AWSXRayRecorder.Instance.TraceContext.GetEntity(); _recorder.EndSegment(); -#if NET45 +#if NETFRAMEWORK Assert.AreEqual(".NET Framework", segment.Service["runtime"]); #else Assert.AreEqual(".NET Core Framework", segment.Service["runtime"]); @@ -941,7 +941,7 @@ public void TestOverrideContextMissingStrategyToLogError() public void TestDefaultTraceContext() { var recorder = AWSXRayRecorder.Instance; -#if NET45 +#if NETFRAMEWORK Assert.AreEqual(typeof(CallContextContainer).FullName, recorder.TraceContext.GetType().FullName); #else Assert.AreEqual(typeof(AsyncLocalContextContainer).FullName, recorder.TraceContext.GetType().FullName); @@ -952,7 +952,7 @@ public void TestDefaultTraceContext() public void TestInitializeInstanceWithRecorder1() { AWSXRayRecorder recorder = BuildAWSXRayRecorder(new TestSamplingStrategy()); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); @@ -970,7 +970,7 @@ public void TestInitializeInstanceWithRecorder2() // setting custom daemon addre IPEndPoint expectedUDPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.2"), 2001); IPEndPoint expectedTCPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 2000); AWSXRayRecorder recorder = BuildAWSXRayRecorder(new TestSamplingStrategy(), daemonAddress: daemonAddress); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); @@ -991,7 +991,7 @@ public void TestInitializeInstanceWithRecorder3() // setting custom daemon addre IPEndPoint expectedUDPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.2"), 2001); IPEndPoint expectedTCPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 2000); AWSXRayRecorder recorder = BuildAWSXRayRecorder(daemonAddress: daemonAddress); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); @@ -1014,7 +1014,7 @@ public void TestInitializeInstanceWithRecorder3() // setting custom daemon addre public void TestInitializeInstanceWithRecorde4() // Set custom trace context { AWSXRayRecorder recorder = BuildAWSXRayRecorder(traceContext:new DummyTraceContext()); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); diff --git a/sdk/test/UnitTests/CauseTest.cs b/sdk/test/UnitTests/CauseTest.cs index 82ba3db3..200cb1e3 100644 --- a/sdk/test/UnitTests/CauseTest.cs +++ b/sdk/test/UnitTests/CauseTest.cs @@ -31,7 +31,7 @@ public class CauseTest : TestBase public void TestInitialize() { _recorder = new AWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); diff --git a/sdk/test/UnitTests/DbCommandInterceptorTests.cs b/sdk/test/UnitTests/DbCommandInterceptorTests.cs index c70f3331..10d6949c 100644 --- a/sdk/test/UnitTests/DbCommandInterceptorTests.cs +++ b/sdk/test/UnitTests/DbCommandInterceptorTests.cs @@ -59,7 +59,7 @@ public void TestInitialize() public new void TestCleanup() { base.TestCleanup(); -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[_collectSqlQueriesKey] = string.Empty; AppSettings.Reset(); #endif @@ -70,7 +70,7 @@ public void TestInitialize() public void Intercept_DoesNot_CollectQueries_When_NotEnabled() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions() }; @@ -94,7 +94,7 @@ public void Intercept_DoesNot_CollectQueries_When_NotEnabled() public async Task InterceptAsync_DoesNot_CollectQueries_When_NotEnabled() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions() }; @@ -118,7 +118,7 @@ public async Task InterceptAsync_DoesNot_CollectQueries_When_NotEnabled() public void Intercept_CollectsQueries_When_DisabledGlobally_And_EnabledLocally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = false } }; @@ -142,7 +142,7 @@ public void Intercept_CollectsQueries_When_DisabledGlobally_And_EnabledLocally() public async Task InterceptAsync_CollectsQueries_When_DisabledGlobally_And_EnabledLocally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = false } }; @@ -166,7 +166,7 @@ public async Task InterceptAsync_CollectsQueries_When_DisabledGlobally_And_Enabl public void Intercept_CollectsQueries_When_EnabledGlobally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = true } }; @@ -190,7 +190,7 @@ public void Intercept_CollectsQueries_When_EnabledGlobally() public async Task InterceptAsync_CollectsQueries_When_EnabledGlobally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = true } }; @@ -214,7 +214,7 @@ public async Task InterceptAsync_CollectsQueries_When_EnabledGlobally() public void Intercept_DoesNot_CollectQueries_When_EnabledGlobally_And_DisabledLocally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = true } }; @@ -238,7 +238,7 @@ public void Intercept_DoesNot_CollectQueries_When_EnabledGlobally_And_DisabledLo public async Task InterceptAsync_DoesNot_CollectQueries_When_EnabledGlobally_And_DisabledLocally() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = true } }; @@ -262,7 +262,7 @@ public async Task InterceptAsync_DoesNot_CollectQueries_When_EnabledGlobally_And public void TestTrustedConnection_DoesNotCollectUserID() { // arrange -#if !NET45 +#if !NETFRAMEWORK var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions() }; diff --git a/sdk/test/UnitTests/HttpClientXRayTracingHandlerTests.cs b/sdk/test/UnitTests/HttpClientXRayTracingHandlerTests.cs index 77cc773f..964668c6 100644 --- a/sdk/test/UnitTests/HttpClientXRayTracingHandlerTests.cs +++ b/sdk/test/UnitTests/HttpClientXRayTracingHandlerTests.cs @@ -32,7 +32,7 @@ public HttpClientXRayTracingHandlerTests() public void TestInitialize() { _recorder = new AWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -77,7 +77,7 @@ public async Task TestSendAsync() public async Task TestXrayDisabledSendAsync() { _recorder = new MockAWSXRayRecorder() { IsTracingDisabledValue = true }; -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -117,7 +117,7 @@ public async Task Test404SendAsync() public async Task TestXrayContextMissingStrategySendAsync() // Test that respects ContextMissingStrategy { _recorder = new MockAWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); diff --git a/sdk/test/UnitTests/HttpWebRequestTracingExtensionTests.cs b/sdk/test/UnitTests/HttpWebRequestTracingExtensionTests.cs index 76b92a9d..e6f4684a 100644 --- a/sdk/test/UnitTests/HttpWebRequestTracingExtensionTests.cs +++ b/sdk/test/UnitTests/HttpWebRequestTracingExtensionTests.cs @@ -41,7 +41,7 @@ public class HttpWebRequestTracingExtensionTests : TestBase public void TestInitialize() { _recorder = new AWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -87,7 +87,7 @@ public void TestGetResponseTraced() public void TestXrayDisabledGetResponseTraced() { _recorder = new MockAWSXRayRecorder() { IsTracingDisabledValue = true }; -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -134,7 +134,7 @@ public async Task TestGetAsyncResponseTraced() public async Task TestXrayDisabledGetAsyncResponseTraced() { _recorder = new MockAWSXRayRecorder() { IsTracingDisabledValue = true }; -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); @@ -150,7 +150,7 @@ public async Task TestXrayDisabledGetAsyncResponseTraced() } } -#if !NET45 +#if !NETFRAMEWORK [TestMethod] public void TestExceptionGetResponseTraced() { @@ -222,7 +222,7 @@ public async Task TestExceptionGetAsyncResponseTraced() public async Task TestContextMissingStrategyGetAsyncResponseTraced() { _recorder = new AWSXRayRecorder(); -#if NET45 +#if NETFRAMEWORK AWSXRayRecorder.InitializeInstance(_recorder); #else AWSXRayRecorder.InitializeInstance(recorder: _recorder); diff --git a/sdk/test/UnitTests/LocalizedSamplingStrategyTests.cs b/sdk/test/UnitTests/LocalizedSamplingStrategyTests.cs index 85b1ee9f..709d1aa5 100644 --- a/sdk/test/UnitTests/LocalizedSamplingStrategyTests.cs +++ b/sdk/test/UnitTests/LocalizedSamplingStrategyTests.cs @@ -34,14 +34,14 @@ namespace Amazon.XRay.Recorder.UnitTests public class LocalizedSamplingStrategyTests { private const string ManifestKey = "SamplingRuleManifest"; -#if !NET45 +#if !NETFRAMEWORK private XRayOptions _xRayOtions = new XRayOptions(); #endif [TestCleanup] public void TestCleanup() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = null; AppSettings.Reset(); #else @@ -115,7 +115,7 @@ public void TestDefaultRuleWithRequest() [TestMethod] public void TestLoadJsonConfiguration() // version 1 { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = @"JSONs\DefaultSamplingRules.json"; AppSettings.Reset(); var strategy = new LocalizedSamplingStrategy(AppSettings.SamplingRuleManifest); @@ -143,7 +143,7 @@ public void TestLoadJsonConfiguration() // version 1 [TestMethod] public void TestLoadJsonConfiguration1() // Version 2 { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = @"JSONs\DefaultSamplingRules1.json"; AppSettings.Reset(); var strategy = new LocalizedSamplingStrategy(AppSettings.SamplingRuleManifest); @@ -173,7 +173,7 @@ public void TestLoadJsonConfiguration1() // Version 2 [ExpectedException(typeof(InvalidSamplingConfigurationException))] public void TestLoadSamplingRulesWithoutDefaultRule() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = @"JSONs\SamplingRulesWithoutDefault.json"; AppSettings.Reset(); var strategy = new LocalizedSamplingStrategy(AppSettings.SamplingRuleManifest); @@ -187,7 +187,7 @@ public void TestLoadSamplingRulesWithoutDefaultRule() [ExpectedException(typeof(InvalidSamplingConfigurationException))] public void TestLoadSamplingRulesWithInvalidVersion1() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = @"JSONs\SamplingRulesInvalidV1.json"; AppSettings.Reset(); var strategy = new LocalizedSamplingStrategy(AppSettings.SamplingRuleManifest); @@ -201,7 +201,7 @@ public void TestLoadSamplingRulesWithInvalidVersion1() [ExpectedException(typeof(InvalidSamplingConfigurationException))] public void TestLoadSamplingRulesWithInvalidVersion2() { -#if NET45 +#if NETFRAMEWORK ConfigurationManager.AppSettings[ManifestKey] = @"JSONs\SamplingRulesInvalidV2.json"; AppSettings.Reset(); var strategy = new LocalizedSamplingStrategy(AppSettings.SamplingRuleManifest); diff --git a/sdk/test/UnitTests/SegmentNamingStrategyTests.cs b/sdk/test/UnitTests/SegmentNamingStrategyTests.cs index 74db2aa2..8da89293 100644 --- a/sdk/test/UnitTests/SegmentNamingStrategyTests.cs +++ b/sdk/test/UnitTests/SegmentNamingStrategyTests.cs @@ -19,7 +19,7 @@ using System.Net.Http; using Amazon.XRay.Recorder.Core.Strategies; using Microsoft.VisualStudio.TestTools.UnitTesting; -#if !NET45 +#if !NETFRAMEWORK using Microsoft.AspNetCore.Http; #endif @@ -28,7 +28,7 @@ namespace Amazon.XRay.Recorder.UnitTests [TestClass] public class SegmentNamingStrategyTests { -#if NET45 +#if NETFRAMEWORK private HttpRequestMessage _request; #else private HttpRequest _request; @@ -36,7 +36,7 @@ public class SegmentNamingStrategyTests [TestInitialize] public void TestInitialize() { -#if NET45 +#if NETFRAMEWORK _request = new HttpRequestMessage(); #else _request = new DefaultHttpContext().Request; diff --git a/sdk/test/UnitTests/SegmentTests.cs b/sdk/test/UnitTests/SegmentTests.cs index 5b32ab01..b9109bf9 100644 --- a/sdk/test/UnitTests/SegmentTests.cs +++ b/sdk/test/UnitTests/SegmentTests.cs @@ -312,7 +312,7 @@ public void TestHttpOverwriteValue() } -#if NET45 +#if NETFRAMEWORK [TestMethod] public void TestSegmentIsSerializable() { diff --git a/sdk/test/UnitTests/Tools/CustomResponses.cs b/sdk/test/UnitTests/Tools/CustomResponses.cs index e81f47af..5196305a 100644 --- a/sdk/test/UnitTests/Tools/CustomResponses.cs +++ b/sdk/test/UnitTests/Tools/CustomResponses.cs @@ -29,7 +29,7 @@ namespace Amazon.XRay.Recorder.UnitTests.Tools { public static class CustomResponses { -#if NET45 +#if NETFRAMEWORK public static void SetResponse( AmazonServiceClient client, string requestId = null, string s3ExtendedRequestId = null, string content = null, bool isOK = true) { diff --git a/sdk/test/UnitTests/Tools/MockWebResponse.cs b/sdk/test/UnitTests/Tools/MockWebResponse.cs index 1af0eb42..8ee5a201 100644 --- a/sdk/test/UnitTests/Tools/MockWebResponse.cs +++ b/sdk/test/UnitTests/Tools/MockWebResponse.cs @@ -27,7 +27,7 @@ namespace Amazon.XRay.Recorder.UnitTests.Tools { public class MockWebResponse { -#if NET45 +#if NETFRAMEWORK public static HttpWebResponse CreateFromResource(string resourceName) { var rawResponse = Utils.GetResourceText(resourceName);