Skip to content

Commit

Permalink
remove net48 target
Browse files Browse the repository at this point in the history
  • Loading branch information
thefringeninja committed Jan 24, 2022
1 parent 38de296 commit 252bf35
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 206 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
framework: [netcoreapp3.1, net5.0, net48]
framework: [netcoreapp3.1, net5.0]
os: [ubuntu-18.04, windows-latest]
runs-on: ${{ matrix.os }}
name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }}
Expand All @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
framework: [netcoreapp3.1, net5.0, net48]
framework: [netcoreapp3.1, net5.0]
os: [ubuntu-18.04]
test: ["", .Streams, .PersistentSubscriptions, .Operations, .UserManagement, .ProjectionManagement]
configuration: [release]
Expand Down
10 changes: 1 addition & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<Platform>x64</Platform>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Nullable>disable</Nullable>
Expand All @@ -14,12 +14,4 @@
<RootNamespace>EventStore.Client</RootNamespace>
<UseLinkBase>true</UseLinkBase>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="2.0.3"/>
<PackageReference Include="System.Net.Http" Version="4.3.4"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="IndexRange" Version="1.0.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>
13 changes: 0 additions & 13 deletions src/EventStore.Client.Common/DeconstructionExtensions.cs

This file was deleted.

8 changes: 1 addition & 7 deletions src/EventStore.Client.Common/EpochExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
#nullable enable
namespace EventStore.Client {
internal static class EpochExtensions {
private static readonly DateTime UnixEpoch =
#if NETFRAMEWORK
new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
#else
DateTime.UnixEpoch
#endif
;
private static readonly DateTime UnixEpoch = DateTime.UnixEpoch;

public static DateTime FromTicksSinceEpoch(this long value) =>
new DateTime(UnixEpoch.Ticks + value, DateTimeKind.Utc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ public async Task<JsonDocument> GetResultAsync(string name, string? partition =
var value = await GetResultInternalAsync(name, partition, userCredentials, cancellationToken)
.ConfigureAwait(false);

#if !NETFRAMEWORK
await
#endif
using var stream = new MemoryStream();
await using var stream = new MemoryStream();
await using var writer = new Utf8JsonWriter(stream);
var serializer = new ValueSerializer();
serializer.Write(writer, value, new JsonSerializerOptions());
Expand All @@ -50,10 +47,7 @@ public async Task<T> GetResultAsync<T>(string name, string? partition = null,
CancellationToken cancellationToken = default) {
var value = await GetResultInternalAsync(name, partition, userCredentials, cancellationToken)
.ConfigureAwait(false);
#if !NETFRAMEWORK
await
#endif
using var stream = new MemoryStream();
await using var stream = new MemoryStream();
await using var writer = new Utf8JsonWriter(stream);
var serializer = new ValueSerializer();
serializer.Write(writer, value, new JsonSerializerOptions());
Expand Down Expand Up @@ -92,10 +86,7 @@ public async Task<JsonDocument> GetStateAsync(string name, string? partition = n
var value = await GetStateInternalAsync(name, partition, userCredentials, cancellationToken)
.ConfigureAwait(false);

#if !NETFRAMEWORK
await
#endif
using var stream = new MemoryStream();
await using var stream = new MemoryStream();
await using var writer = new Utf8JsonWriter(stream);
var serializer = new ValueSerializer();
serializer.Write(writer, value, new JsonSerializerOptions());
Expand All @@ -121,10 +112,7 @@ public async Task<T> GetStateAsync<T>(string name, string? partition = null,
var value = await GetStateInternalAsync(name, partition, userCredentials, cancellationToken)
.ConfigureAwait(false);

#if !NETFRAMEWORK
await
#endif
using var stream = new MemoryStream();
await using var stream = new MemoryStream();
await using var writer = new Utf8JsonWriter(stream);
var serializer = new ValueSerializer();
serializer.Write(writer, value, new JsonSerializerOptions());
Expand Down
20 changes: 0 additions & 20 deletions src/EventStore.Client.Streams/ChannelReaderExtensions.cs

This file was deleted.

23 changes: 5 additions & 18 deletions src/EventStore.Client/ChannelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ public static GrpcChannel CreateChannel(EventStoreClientSettings settings, EndPo
public static GrpcChannel CreateChannel(EventStoreClientSettings settings, Uri? address) {
address ??= settings.ConnectivitySettings.Address;

#if !NETFRAMEWORK
if (address.Scheme == Uri.UriSchemeHttp ||settings.ConnectivitySettings.Insecure) {
//this must be switched on before creation of the HttpMessageHandler
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
}
#endif
return GrpcChannel.ForAddress(address, new GrpcChannelOptions {
HttpClient = new HttpClient(CreateHandler(), true) {
Timeout = System.Threading.Timeout.InfiniteTimeSpan,
#if !NETFRAMEWORK
DefaultRequestVersion = new Version(2, 0),
#endif
},
LoggerFactory = settings.LoggerFactory,
Credentials = settings.ChannelCredentials,
Expand All @@ -35,22 +31,13 @@ HttpMessageHandler CreateHandler() {
return settings.CreateHttpMessageHandler.Invoke();
}

return new
#if !NETFRAMEWORK
SocketsHttpHandler {

return new SocketsHttpHandler {
#if NET5_0_OR_GREATER
KeepAlivePingDelay = settings.ConnectivitySettings.KeepAliveInterval,
KeepAlivePingTimeout = settings.ConnectivitySettings.KeepAliveTimeout,
EnableMultipleHttp2Connections = true
#endif
}
#else
HttpClientHandler {

}
KeepAlivePingDelay = settings.ConnectivitySettings.KeepAliveInterval,
KeepAlivePingTimeout = settings.ConnectivitySettings.KeepAliveTimeout,
EnableMultipleHttp2Connections = true
#endif
;
};
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/EventStore.Client/EventStore.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="System.Linq.Async" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="System.Threading.Channels" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) != 'net5.0'">
<ItemGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<PackageReference Include="System.Text.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions src/EventStore.Client/EventStoreClientConnectivitySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ public class EventStoreClientConnectivitySettings {
/// </summary>
public TimeSpan GossipTimeout { get; set; }

#if !NETFRAMEWORK

/// <summary>
/// Whether or not to use HTTPS when communicating via gossip.
/// </summary>
[Obsolete]
public bool GossipOverHttps { get; set; } = true;
#endif

/// <summary>
/// The polling interval used to discover the <see cref="EndPoint"/>.
Expand Down
17 changes: 4 additions & 13 deletions src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,15 @@ private static EventStoreClientSettings CreateSettings(string scheme, (string us

settings.CreateHttpMessageHandler = () => {
var handler =
#if NETFRAMEWORK
new HttpClientHandler()
#else
new SocketsHttpHandler {
#if NET5_0_OR_GREATER
KeepAlivePingDelay = settings.ConnectivitySettings.KeepAliveInterval,
KeepAlivePingTimeout = settings.ConnectivitySettings.KeepAliveTimeout
KeepAlivePingTimeout = settings.ConnectivitySettings.KeepAliveTimeout,
EnableMultipleHttp2Connections = true
#endif
}
#endif
;
};
if (typedOptions.TryGetValue(TlsVerifyCert, out var tlsVerifyCert) && !(bool)tlsVerifyCert) {
#if NETFRAMEWORK
handler.ServerCertificateCustomValidationCallback
#else
handler.SslOptions.RemoteCertificateValidationCallback
#endif
= delegate { return true; };
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
}

return handler;
Expand Down
8 changes: 1 addition & 7 deletions src/EventStore.Client/StreamIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ public static implicit operator string(StreamIdentifier source) {
}
if (source._cached != null || source.StreamName.IsEmpty) return source._cached;

var tmp = Encoding.UTF8.GetString(
#if NETFRAMEWORK
source.StreamName.ToByteArray()
#else
source.StreamName.Span
#endif
);
var tmp = Encoding.UTF8.GetString(source.StreamName.Span);
//this doesn't have to be thread safe, its just a cache in case the identifier is turned into a string several times
source._cached = tmp;
return source._cached;
Expand Down
31 changes: 1 addition & 30 deletions src/EventStore.Client/Uuid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ private Uuid(Guid value) {
throw new NotSupportedException();
}

#if NETFRAMEWORK
var data = value.ToByteArray();

Array.Reverse(data, 0, 8);
Array.Reverse(data, 0, 2);
Array.Reverse(data, 2, 2);
Array.Reverse(data, 4, 4);
Array.Reverse(data, 8, 8);

_msb = BitConverter.ToInt64(data, 0);
_lsb = BitConverter.ToInt64(data, 8);
#else
Span<byte> data = stackalloc byte[16];

if (!value.TryWriteBytes(data)) {
Expand All @@ -91,7 +79,6 @@ private Uuid(Guid value) {

_msb = BitConverter.ToInt64(data);
_lsb = BitConverter.ToInt64(data.Slice(8));
#endif
}

private Uuid(string value) : this(value == null
Expand Down Expand Up @@ -160,21 +147,7 @@ public Guid ToGuid() {
if (!BitConverter.IsLittleEndian) {
throw new NotSupportedException();
}
#if NETFRAMEWORK
var msb = BitConverter.GetBytes(_msb);
Array.Reverse(msb, 0, 8);
Array.Reverse(msb, 0, 4);
Array.Reverse(msb, 4, 2);
Array.Reverse(msb, 6, 2);

var lsb = BitConverter.GetBytes(_lsb);
Array.Reverse(lsb);

var data = new byte[16];
Array.Copy(msb, data, 8);
Array.Copy(lsb, 0, data, 8, 8);
return new Guid(data);
#else

Span<byte> data = stackalloc byte[16];
if (!BitConverter.TryWriteBytes(data, _msb) ||
!BitConverter.TryWriteBytes(data.Slice(8), _lsb)) {
Expand All @@ -188,8 +161,6 @@ public Guid ToGuid() {
data.Slice(8).Reverse();

return new Guid(data);

#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ public Issue_1125(Fixture fixture) {
public static IEnumerable<object[]> TestCases() => Enumerable.Range(0, 50)
.Select(i => new object[] {i});

[Theory(
#if NETFRAMEWORK
Skip = "Really flaky on .net frameork"
#endif
), MemberData(nameof(TestCases))]
[Theory, MemberData(nameof(TestCases))]
public async Task persistent_subscription_delivers_all_events(int iteration) {
if (Environment.OSVersion.IsWindows()) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
using Xunit;

namespace EventStore.Client {
#if !NETCOREAPP3_1_OR_GREATER
[Trait("Category", "Network")]
public class append_to_stream_with_timeout : IClassFixture<append_to_stream_with_timeout.Fixture> {
private readonly Fixture _fixture;
Expand Down Expand Up @@ -52,5 +49,4 @@ public class Fixture : EventStoreClientFixture {
protected override Task When() => Task.CompletedTask;
}
}
#endif
}
15 changes: 3 additions & 12 deletions test/EventStore.Client.Tests.Common/EventStoreTestServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,9 @@ public EventStoreTestServer(
VerifyCertificatesExist();

_httpClient = new HttpClient(
#if NETFRAMEWORK
new HttpClientHandler {
ServerCertificateCustomValidationCallback = delegate { return true; }
}
#else
new SocketsHttpHandler {
SslOptions = {
RemoteCertificateValidationCallback = delegate { return true; }
}
}
#endif
) {
new SocketsHttpHandler {
SslOptions = {RemoteCertificateValidationCallback = delegate { return true; }}
}) {
BaseAddress = address,
};

Expand Down
16 changes: 3 additions & 13 deletions test/EventStore.Client.Tests.Common/EventStoreTestServerCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,9 @@ public EventStoreTestServerCluster(

_eventStoreCluster = BuildCluster(envOverrides);

_httpClient = new HttpClient(
#if NETFRAMEWORK
new HttpClientHandler {
ServerCertificateCustomValidationCallback = delegate { return true; }
}
#else
new SocketsHttpHandler {
SslOptions = {
RemoteCertificateValidationCallback = delegate { return true; }
}
}
#endif
) {
_httpClient = new HttpClient(new SocketsHttpHandler {
SslOptions = {RemoteCertificateValidationCallback = delegate { return true; }}
}) {
BaseAddress = address,
};
}
Expand Down
Loading

0 comments on commit 252bf35

Please sign in to comment.