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

Target netstandard2.1 instead of netcoreapp3.1 #698

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/StreamJsonRpc/JsonRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ private async ValueTask<JsonRpcMessage> DispatchIncomingRequestAsync(JsonRpcRequ

// Be sure to dispose the link to the local method token we created in case it is linked to our long-lived disposal token
// and otherwise cause a memory leak.
#if NETCOREAPP
#if NETSTANDARD2_1_OR_GREATER
await disconnectedRegistration.DisposeAsync().ConfigureAwait(false);
#else
disconnectedRegistration.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion src/StreamJsonRpc/MessagePackFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ private static void WriteProtocolVersionPropertyAndValue(ref MessagePackWriter w
private static void ReadUnknownProperty(ref MessagePackReader reader, ref Dictionary<string, ReadOnlySequence<byte>>? topLevelProperties, ReadOnlySpan<byte> stringKey)
{
topLevelProperties ??= new Dictionary<string, ReadOnlySequence<byte>>(StringComparer.Ordinal);
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER
string name = Encoding.UTF8.GetString(stringKey);
#else
string name = Encoding.UTF8.GetString(stringKey.ToArray());
Expand Down
2 changes: 1 addition & 1 deletion src/StreamJsonRpc/RequestId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public RequestId(string? id)
public override bool Equals(object? obj) => obj is RequestId other && this.Equals(other);

/// <inheritdoc/>
#if NETCOREAPP
#if NETSTANDARD2_1_OR_GREATER
public override int GetHashCode() => this.Number?.GetHashCode() ?? this.String?.GetHashCode(StringComparison.Ordinal) ?? 0;
#else
public override int GetHashCode() => this.Number?.GetHashCode() ?? this.String?.GetHashCode() ?? 0;
Expand Down
2 changes: 1 addition & 1 deletion src/StreamJsonRpc/StreamJsonRpc.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
6 changes: 3 additions & 3 deletions src/StreamJsonRpc/WebSocketMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ void IJsonRpcMessageBufferManager.DeserializationComplete(JsonRpcMessage message
/// <inheritdoc />
protected override async ValueTask<JsonRpcMessage?> ReadCoreAsync(CancellationToken cancellationToken)
{
#if NETCOREAPP2_1
#if NETSTANDARD2_1_OR_GREATER
ValueWebSocketReceiveResult result;
#else
WebSocketReceiveResult result;
#endif
do
{
#if NETCOREAPP2_1
#if NETSTANDARD2_1_OR_GREATER
Memory<byte> memory = this.contentSequenceBuilder.GetMemory(this.sizeHint);
result = await this.WebSocket.ReceiveAsync(memory, cancellationToken).ConfigureAwait(false);
this.contentSequenceBuilder.Advance(result.Count);
Expand Down Expand Up @@ -161,7 +161,7 @@ protected override async ValueTask WriteCoreAsync(JsonRpcMessage content, Cancel
foreach (ReadOnlyMemory<byte> memory in contentSequence)
{
bool endOfMessage = bytesCopied + memory.Length == contentSequence.Length;
#if NETCOREAPP2_1
#if NETSTANDARD2_1_OR_GREATER
await this.WebSocket.SendAsync(memory, messageType, endOfMessage, cancellationToken).ConfigureAwait(false);
#else
if (MemoryMarshal.TryGetArray(memory, out ArraySegment<byte> segment))
Expand Down