Skip to content

Commit

Permalink
Removing NetStandard support for OMEX (#650)
Browse files Browse the repository at this point in the history
* Removing NetStandard support for OMEX

* Update Microsoft.Omex.Extensions.Diagnostics.HealthChecks.UnitTests.csproj

* Update Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.UnitTests.csproj

* Delete src/Abstractions/NetStandardCompatability.cs

* Update NullableAssert.cs

* Update HttpEndpointHealthCheck.cs

* Update Validation.cs

* Update NullableAssert.cs

* Fixing typo

* Remove netstandard and framework build references

* Updating to use AppendJoin

* Removing unused function

* Test removal of SF step

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

---------

Co-authored-by: Neil Richardson <neil.richardson@microsoft.com>
Co-authored-by: Keith Cully <2370032+K-Cully@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 6, 2024
1 parent 423f9d8 commit 727d0ff
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 100 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<OldestSupportedDotNetVersion>net8.0</OldestSupportedDotNetVersion>
<NetCoreVersions>$(LatestSupportedDotNetVersion)</NetCoreVersions>
<NetCoreVersions Condition="'$(LatestSupportedDotNetVersion)' != '$(OldestSupportedDotNetVersion)'">$(LatestSupportedDotNetVersion);$(OldestSupportedDotNetVersion)</NetCoreVersions>
<NetStandardVersions>netstandard2.0</NetStandardVersions>
<LibraryTargetFrameworks>$(NetCoreVersions);$(NetStandardVersions)</LibraryTargetFrameworks>
<LibraryTargetFrameworks>$(NetCoreVersions)</LibraryTargetFrameworks>
<ExecutableTargetFrameworks>$(NetCoreVersions)</ExecutableTargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="UnitTest Targets">
Expand All @@ -27,12 +26,6 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="Condition Variables" >
<IsNetStandard>$(NetStandardVersions.Contains('$(TargetFramework)'))</IsNetStandard>
<IsNetCore>$(NetCoreVersions.Contains('$(TargetFramework)'))</IsNetCore>
<IsNetFramework>false</IsNetFramework>
<IsNetFramework Condition="!$(IsNetStandard) And !$(IsNetCore)">true</IsNetFramework>
</PropertyGroup>
<PropertyGroup Label="Signing" >
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
</ItemGroup>
<ItemGroup Condition="!$(IsNetCore)">
<PackageReference Include="System.Threading.Tasks.Extensions" />
</ItemGroup>
</Project>
37 changes: 0 additions & 37 deletions src/Abstractions/NetStandardCompatability.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Abstractions/Validation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 0 additions & 30 deletions src/Activities/Internal/ActivityLoggerHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,5 @@ internal static class ActivityLoggerHelpers

public static StringBuilder AppendParamName(this StringBuilder builder, string name) =>
builder.Append(name).Append(':');

/// <summary>
/// Appends collection of key value pairs to StringBuilder, by calling ToSting on key and value
/// </summary>
/// <remarks>
/// TODO: should be replaced by AppendJoin when we remove netstandard target, since KeyValuePair also overrides ToString
/// </remarks>
public static StringBuilder AppendPairs<T>(this StringBuilder builder, IEnumerable<KeyValuePair<string, T>> pairs)
{
builder.AppendArrayStart();

bool isFirst = true;
foreach (KeyValuePair<string, T> pair in pairs)
{
if (!isFirst)
{
builder.AppendSeparator();
}

builder
.AppendObjStart()
.AppendParamName(pair.Key)
.Append(pair.Value)
.AppendObjEnd();
}

builder.AppendArrayEnd();

return builder;
}
}
}
4 changes: 2 additions & 2 deletions src/Activities/Internal/ActivityObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object?> option in message.Options)
{
clone.Options.Set(new HttpRequestOptionsKey<object?>(option.Key), option.Value);
}
#else
foreach (KeyValuePair<string, object> prop in message.Properties)
{
clone.Properties.Add(prop.Key, prop.Value);
}
#endif

return clone;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
</ItemGroup>
<ItemGroup Condition="!$(IsNetCore)">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Abstractions\Microsoft.Omex.Extensions.Abstractions.csproj" />
<ProjectReference Include="..\ServiceFabricGuest.Abstractions\Microsoft.Omex.Extensions.ServiceFabricGuest.Abstractions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@
<ProjectReference Include="..\..\src\Testing.Helpers\Microsoft.Omex.Extensions.Testing.Helpers.csproj" />
<ProjectReference Include="..\Abstractions.UnitTests\Microsoft.Omex.Extensions.Abstractions.UnitTests.csproj" />
</ItemGroup>
<ItemGroup Condition="$(IsNetFramework)">
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@
<PackageReference Include="Newtonsoft.Json" /> <!-- Bump version of transitive dependency -->
<PackageReference Include="ServiceFabric.Mocks" />
</ItemGroup>
<ItemGroup Condition="$(IsNetFramework)">
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>

0 comments on commit 727d0ff

Please sign in to comment.