Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing NetStandard support for OMEX #650

Merged
merged 23 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# Install SF SDK
- name: Install SF
shell: pwsh
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
- name: Build with dotnet
run: dotnet build --configuration ${{ matrix.configuration }}
- name: Run Unit Tests
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>
neilr81 marked this conversation as resolved.
Show resolved Hide resolved
<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>
Loading