Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c3f132f

Browse files
committed
remove .netstandard2.1 build + move ambiguous ext methods to SS.Extensions
1 parent 599e10c commit c3f132f

File tree

7 files changed

+48
-66
lines changed

7 files changed

+48
-66
lines changed

src/ServiceStack.Memory/ServiceStack.Memory.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp2.1;netstandard2.1</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
44
</PropertyGroup>
55
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
66
<DefineConstants>$(DefineConstants);NETSTANDARD;NETCORE2_1</DefineConstants>
77
</PropertyGroup>
8-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
9-
<DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_1</DefineConstants>
10-
</PropertyGroup>
118
<ItemGroup>
129
<ProjectReference Include="..\ServiceStack.Text\ServiceStack.Text.csproj" />
1310
</ItemGroup>

src/ServiceStack.Text/CharMemoryExtensions.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -381,41 +381,6 @@ public static int LastIndexOf(this ReadOnlyMemory<char> value, string needle, in
381381
[MethodImpl(MethodImplOptions.AggressiveInlining)]
382382
public static bool EqualsOrdinal(this ReadOnlyMemory<char> value, ReadOnlyMemory<char> other) => value.Span.Equals(other.Span, StringComparison.Ordinal);
383383

384-
#if !NETSTANDARD2_1
385-
//Ambiguous definitions in .NET Core 3.0 System MemoryExtensions.cs
386-
387-
public static ReadOnlyMemory<char> Trim(this ReadOnlyMemory<char> span)
388-
{
389-
return span.TrimStart().TrimEnd();
390-
}
391-
392-
public static ReadOnlyMemory<char> TrimStart(this ReadOnlyMemory<char> value)
393-
{
394-
if (value.IsEmpty) return TypeConstants.NullStringMemory;
395-
var span = value.Span;
396-
int start = 0;
397-
for (; start < span.Length; start++)
398-
{
399-
if (!char.IsWhiteSpace(span[start]))
400-
break;
401-
}
402-
return value.Slice(start);
403-
}
404-
405-
public static ReadOnlyMemory<char> TrimEnd(this ReadOnlyMemory<char> value)
406-
{
407-
if (value.IsEmpty) return TypeConstants.NullStringMemory;
408-
var span = value.Span;
409-
int end = span.Length - 1;
410-
for (; end >= 0; end--)
411-
{
412-
if (!char.IsWhiteSpace(span[end]))
413-
break;
414-
}
415-
return value.Slice(0, end + 1);
416-
}
417-
#endif
418-
419384
[MethodImpl(MethodImplOptions.AggressiveInlining)]
420385
public static ReadOnlyMemory<char> SafeSlice(this ReadOnlyMemory<char> value, int startIndex) => SafeSlice(value, startIndex, value.Length);
421386

src/ServiceStack.Text/Env.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ static Env()
7272
IsNetStandard20 = true;
7373
#endif
7474

75-
#if NETSTANDARD2_1
76-
IsNetStandard21 = true;
77-
SupportsDynamic = true;
78-
#endif
79-
8075
if (!IsUWP)
8176
{
8277
try
@@ -139,7 +134,6 @@ static Env()
139134

140135
public static bool IsNetCore21 { get; set; }
141136
public static bool IsNetStandard20 { get; set; }
142-
public static bool IsNetStandard21 { get; set; }
143137

144138
public static bool IsNetFramework { get; set; }
145139

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
3+
namespace ServiceStack.Extensions
4+
{
5+
/// <summary>
6+
/// Move conflicting extension methods into 'ServiceStack.Extensions' namespace
7+
/// </summary>
8+
public static class ServiceStackExtensions
9+
{
10+
//Ambiguous definitions in .NET Core 3.0 System MemoryExtensions.cs
11+
12+
public static ReadOnlyMemory<char> Trim(this ReadOnlyMemory<char> span)
13+
{
14+
return span.TrimStart().TrimEnd();
15+
}
16+
17+
public static ReadOnlyMemory<char> TrimStart(this ReadOnlyMemory<char> value)
18+
{
19+
if (value.IsEmpty) return TypeConstants.NullStringMemory;
20+
var span = value.Span;
21+
int start = 0;
22+
for (; start < span.Length; start++)
23+
{
24+
if (!char.IsWhiteSpace(span[start]))
25+
break;
26+
}
27+
return value.Slice(start);
28+
}
29+
30+
public static ReadOnlyMemory<char> TrimEnd(this ReadOnlyMemory<char> value)
31+
{
32+
if (value.IsEmpty) return TypeConstants.NullStringMemory;
33+
var span = value.Span;
34+
int end = span.Length - 1;
35+
for (; end >= 0; end--)
36+
{
37+
if (!char.IsWhiteSpace(span[end]))
38+
break;
39+
}
40+
return value.Slice(0, end + 1);
41+
}
42+
43+
}
44+
}

src/ServiceStack.Text/NetCoreMemory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETCORE2_1 || NETSTANDARD2_1
1+
#if NETCORE2_1
22

33
using System;
44
using System.Buffers.Text;

src/ServiceStack.Text/ServiceStack.Text.Core.csproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PackageId>ServiceStack.Text.Core</PackageId>
44
<AssemblyName>ServiceStack.Text</AssemblyName>
55
<RootNamespace>ServiceStack.Text</RootNamespace>
6-
<TargetFrameworks>netstandard2.0;netcoreapp2.1;netstandard2.1</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;netcoreapp2.1</TargetFrameworks>
77
<Title>ServiceStack.Text .NET Standard 2.0</Title>
88
<PackageDescription>
99
.NET's fastest JSON, JSV and CSV Text Serializers. Fast, Light, Resilient.
@@ -15,9 +15,6 @@
1515
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
1616
<DefineConstants>$(DefineConstants);NETSTANDARD;NETCORE2_1</DefineConstants>
1717
</PropertyGroup>
18-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
19-
<DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_1</DefineConstants>
20-
</PropertyGroup>
2118
<ItemGroup>
2219
<PackageReference Include="System.Memory" Version="4.5.3" />
2320
</ItemGroup>
@@ -31,10 +28,4 @@
3128
<PackageReference Include="System.Reflection.Emit.LightWeight" Version="4.3.0" />
3229
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
3330
</ItemGroup>
34-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
35-
<PackageReference Include="System.Runtime" Version="4.3.1" />
36-
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
37-
<PackageReference Include="System.Reflection.Emit.LightWeight" Version="4.3.0" />
38-
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
39-
</ItemGroup>
4031
</Project>

src/ServiceStack.Text/ServiceStack.Text.csproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<PackageId>ServiceStack.Text</PackageId>
44
<AssemblyName>ServiceStack.Text</AssemblyName>
5-
<TargetFrameworks>net45;netstandard2.0;netcoreapp2.1;netstandard2.1</TargetFrameworks>
5+
<TargetFrameworks>net45;netstandard2.0;netcoreapp2.1</TargetFrameworks>
66
<Title>.NET's fastest JSON Serializer by ServiceStack</Title>
77
<PackageDescription>
88
.NET's fastest JSON, JSV and CSV Text Serializers. Fast, Light, Resilient.
@@ -14,9 +14,6 @@
1414
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
1515
<DefineConstants>$(DefineConstants);NETSTANDARD;NETCORE2_1</DefineConstants>
1616
</PropertyGroup>
17-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
18-
<DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_1</DefineConstants>
19-
</PropertyGroup>
2017
<ItemGroup>
2118
<PackageReference Include="System.Memory" Version="4.5.3" />
2219
</ItemGroup>
@@ -34,10 +31,4 @@
3431
<PackageReference Include="System.Reflection.Emit.LightWeight" Version="4.3.0" />
3532
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
3633
</ItemGroup>
37-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
38-
<PackageReference Include="System.Runtime" Version="4.3.1" />
39-
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
40-
<PackageReference Include="System.Reflection.Emit.LightWeight" Version="4.3.0" />
41-
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
42-
</ItemGroup>
4334
</Project>

0 commit comments

Comments
 (0)