diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 886fb7c3..5883eb97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,9 +29,9 @@ jobs: dotnet-version: '8.0.x' # Install SF SDK - name: Install SF - shell: pwsh - run: | - Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser + shell: powershell + run: | + Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.10.0.1816.9590.exe .\setup.exe /accepteula /force /quiet diff --git a/Directory.Build.props b/Directory.Build.props index 0a6bec8b..71586b7f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,8 +8,7 @@ net8.0 $(LatestSupportedDotNetVersion) $(LatestSupportedDotNetVersion);$(OldestSupportedDotNetVersion) - netstandard2.0 - $(NetCoreVersions);$(NetStandardVersions) + $(NetCoreVersions) $(NetCoreVersions) @@ -27,12 +26,6 @@ latest enable - - $(NetStandardVersions.Contains('$(TargetFramework)')) - $(NetCoreVersions.Contains('$(TargetFramework)')) - false - true - true false diff --git a/src/Abstractions/Microsoft.Omex.Extensions.Abstractions.csproj b/src/Abstractions/Microsoft.Omex.Extensions.Abstractions.csproj index ec9b9340..8a8d4474 100644 --- a/src/Abstractions/Microsoft.Omex.Extensions.Abstractions.csproj +++ b/src/Abstractions/Microsoft.Omex.Extensions.Abstractions.csproj @@ -18,7 +18,4 @@ - - - diff --git a/src/Abstractions/NetStandardCompatability.cs b/src/Abstractions/NetStandardCompatability.cs deleted file mode 100644 index 94c2eec2..00000000 --- a/src/Abstractions/NetStandardCompatability.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. - -#if NETSTANDARD2_0 || NETFRAMEWORK // This marker attribute only available starting from netstandard 2.1, so we need a replacement to build for full framework -namespace System.Diagnostics.CodeAnalysis -{ - /// - /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. - /// - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] - public sealed class NotNullWhenAttribute : Attribute - { - /// - /// Initializes the attribute with the specified return value condition - /// - /// - /// The return value condition. If the method returns this value, the associated parameter will not be null - /// - public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; - - /// - /// Gets the return value condition - /// - public bool ReturnValue { get; } - } -} -#endif - -#if !NET5_0_OR_GREATER -namespace System.Runtime.CompilerServices -{ - /// - /// Stub to allow using record and init properties when building for older targets - /// - public static class IsExternalInit { } -} -#endif diff --git a/src/Abstractions/Validation.cs b/src/Abstractions/Validation.cs index a3181b30..e40f8a63 100644 --- a/src/Abstractions/Validation.cs +++ b/src/Abstractions/Validation.cs @@ -23,7 +23,7 @@ public static string ThrowIfNullOrWhiteSpace(string? value, string? name = null) { if (!string.IsNullOrWhiteSpace(value)) { - return value!; // `!` required because in netstandard2.0 IsNullOrWhiteSpace does not have proper attributes + return value; } _ = value ?? throw new ArgumentNullException(name); diff --git a/src/Activities/Internal/ActivityLoggerHelpers.cs b/src/Activities/Internal/ActivityLoggerHelpers.cs index 109ef328..33234373 100644 --- a/src/Activities/Internal/ActivityLoggerHelpers.cs +++ b/src/Activities/Internal/ActivityLoggerHelpers.cs @@ -20,35 +20,5 @@ internal static class ActivityLoggerHelpers public static StringBuilder AppendParamName(this StringBuilder builder, string name) => builder.Append(name).Append(':'); - - /// - /// Appends collection of key value pairs to StringBuilder, by calling ToSting on key and value - /// - /// - /// TODO: should be replaced by AppendJoin when we remove netstandard target, since KeyValuePair also overrides ToString - /// - public static StringBuilder AppendPairs(this StringBuilder builder, IEnumerable> pairs) - { - builder.AppendArrayStart(); - - bool isFirst = true; - foreach (KeyValuePair pair in pairs) - { - if (!isFirst) - { - builder.AppendSeparator(); - } - - builder - .AppendObjStart() - .AppendParamName(pair.Key) - .Append(pair.Value) - .AppendObjEnd(); - } - - builder.AppendArrayEnd(); - - return builder; - } } } diff --git a/src/Activities/Internal/ActivityObserver.cs b/src/Activities/Internal/ActivityObserver.cs index 8550c48f..318c66de 100644 --- a/src/Activities/Internal/ActivityObserver.cs +++ b/src/Activities/Internal/ActivityObserver.cs @@ -53,8 +53,8 @@ public void OnStop(Activity activity, object? payload = null) .AppendObjStart() .AppendParamName("Id").Append(activity.Id).AppendSeparator() .AppendParamName("Duration").Append(activity.Duration.TotalMilliseconds).AppendSeparator() - .AppendParamName("Baggage").AppendPairs(activity.Baggage).AppendSeparator() - .AppendParamName("Tags").AppendPairs(activity.TagObjects).AppendSeparator() + .AppendParamName("Baggage").AppendJoin(':', activity.Baggage).AppendSeparator() + .AppendParamName("Tags").AppendJoin(':', activity.TagObjects).AppendSeparator() .AppendObjEnd() .ToString(); diff --git a/src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs b/src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs index f8298aba..651920e3 100644 --- a/src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs +++ b/src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs @@ -82,19 +82,12 @@ private static HttpRequestMessage CloneRequestMessage(HttpRequestMessage message clone.Headers.TryAddWithoutValidation(header.Key, header.Value); } -#if !NETCOREAPP3_1 && !NETSTANDARD2_0 clone.VersionPolicy = message.VersionPolicy; foreach (KeyValuePair option in message.Options) { clone.Options.Set(new HttpRequestOptionsKey(option.Key), option.Value); } -#else - foreach (KeyValuePair prop in message.Properties) - { - clone.Properties.Add(prop.Key, prop.Value); - } -#endif return clone; } diff --git a/src/Diagnostics.HealthChecks/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.csproj b/src/Diagnostics.HealthChecks/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.csproj index dc15837f..0b14c788 100644 --- a/src/Diagnostics.HealthChecks/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.csproj +++ b/src/Diagnostics.HealthChecks/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.csproj @@ -17,9 +17,6 @@ - - - diff --git a/tests/Diagnostics.HealthChecks.UnitTests/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.UnitTests.csproj b/tests/Diagnostics.HealthChecks.UnitTests/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.UnitTests.csproj index 1f9ec2c3..9e6e9454 100644 --- a/tests/Diagnostics.HealthChecks.UnitTests/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.UnitTests.csproj +++ b/tests/Diagnostics.HealthChecks.UnitTests/Microsoft.Omex.Extensions.Diagnostics.HealthChecks.UnitTests.csproj @@ -9,7 +9,4 @@ - - - diff --git a/tests/ServiceFabricGuest.Abstractions.UnitTests/Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.UnitTests.csproj b/tests/ServiceFabricGuest.Abstractions.UnitTests/Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.UnitTests.csproj index 3dda320e..c288d2f5 100644 --- a/tests/ServiceFabricGuest.Abstractions.UnitTests/Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.UnitTests.csproj +++ b/tests/ServiceFabricGuest.Abstractions.UnitTests/Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.UnitTests.csproj @@ -15,7 +15,4 @@ - - -