Skip to content

Commit 03e2821

Browse files
authored
Drop netstandard2.1 target (#1647)
1 parent a024b83 commit 03e2821

File tree

17 files changed

+32
-40
lines changed

17 files changed

+32
-40
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ OpenSSH certificate authentication is supported for all of the above, e.g. ssh-e
176176

177177
**SSH.NET** supports the following target frameworks:
178178
* .NETFramework 4.6.2 (and higher)
179-
* .NET Standard 2.0 and 2.1
179+
* .NET Standard 2.0
180180
* .NET 8 (and higher)
181181

182182
## Building the library

src/Renci.SshNet/Abstractions/SocketExtensions.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ public static async Task ConnectAsync(this Socket socket, EndPoint remoteEndpoin
9393
{
9494
args.RemoteEndPoint = remoteEndpoint;
9595

96-
#if NETSTANDARD2_1
97-
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
98-
#else
9996
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
100-
#endif
10197
{
10298
await args.ExecuteAsync(socket.ConnectAsync);
10399
}
@@ -112,11 +108,7 @@ public static async Task<int> ReceiveAsync(this Socket socket, byte[] buffer, in
112108
{
113109
args.SetBuffer(buffer, offset, length);
114110

115-
#if NETSTANDARD2_1
116-
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
117-
#else
118111
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
119-
#endif
120112
{
121113
await args.ExecuteAsync(socket.ReceiveAsync);
122114
}

src/Renci.SshNet/Abstractions/StreamExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETFRAMEWORK || NETSTANDARD2_0
1+
#if !NET
22
using System;
33
using System.IO;
44
using System.Threading.Tasks;

src/Renci.SshNet/ClientAuthentication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private bool TryAuthenticate(ISession session,
105105
{
106106
authenticationException = new SshAuthenticationException(string.Format(CultureInfo.InvariantCulture,
107107
"No suitable authentication method found to complete authentication ({0}).",
108-
#if NET || NETSTANDARD2_1
108+
#if NET
109109
string.Join(',', allowedAuthenticationMethods)))
110110
#else
111111
string.Join(",", allowedAuthenticationMethods)))

src/Renci.SshNet/Common/Extensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal static ServiceName ToServiceName(this byte[] data)
5050

5151
internal static BigInteger ToBigInteger(this ReadOnlySpan<byte> data)
5252
{
53-
#if NETSTANDARD2_1 || NET
53+
#if NET
5454
return new BigInteger(data, isBigEndian: true);
5555
#else
5656
var reversed = data.ToArray();
@@ -61,7 +61,7 @@ internal static BigInteger ToBigInteger(this ReadOnlySpan<byte> data)
6161

6262
internal static BigInteger ToBigInteger(this byte[] data)
6363
{
64-
#if NETSTANDARD2_1 || NET
64+
#if NET
6565
return new BigInteger(data, isBigEndian: true);
6666
#else
6767
var reversed = new byte[data.Length];
@@ -76,7 +76,7 @@ internal static BigInteger ToBigInteger(this byte[] data)
7676
/// </summary>
7777
public static BigInteger ToBigInteger2(this byte[] data)
7878
{
79-
#if NETSTANDARD2_1 || NET
79+
#if NET
8080
return new BigInteger(data, isBigEndian: true, isUnsigned: true);
8181
#else
8282
if ((data[0] & (1 << 7)) != 0)
@@ -91,7 +91,7 @@ public static BigInteger ToBigInteger2(this byte[] data)
9191
#endif
9292
}
9393

94-
#if NETFRAMEWORK || NETSTANDARD2_0
94+
#if !NET
9595
public static byte[] ToByteArray(this BigInteger bigInt, bool isUnsigned = false, bool isBigEndian = false)
9696
{
9797
var data = bigInt.ToByteArray();
@@ -361,7 +361,7 @@ internal static string Join(this IEnumerable<string> values, string separator)
361361
return string.Join(separator, values);
362362
}
363363

364-
#if NETFRAMEWORK || NETSTANDARD2_0
364+
#if !NET
365365
internal static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
366366
{
367367
if (!dictionary.ContainsKey(key))

src/Renci.SshNet/Common/PipeStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override int Read(byte[] buffer, int offset, int count)
5151
return Read(buffer.AsSpan(offset, count));
5252
}
5353

54-
#if NETSTANDARD2_1 || NET
54+
#if NET
5555
/// <inheritdoc/>
5656
public override int Read(Span<byte> buffer)
5757
#else
@@ -99,7 +99,7 @@ public override void Write(byte[] buffer, int offset, int count)
9999
}
100100
}
101101

102-
#if NETSTANDARD2_1 || NET
102+
#if NET
103103
/// <inheritdoc/>
104104
public override void Write(ReadOnlySpan<byte> buffer)
105105
{
@@ -157,7 +157,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
157157
return WriteAsync(buffer.AsMemory(offset, count), cancellationToken).AsTask();
158158
}
159159

160-
#if NETSTANDARD2_1 || NET
160+
#if NET
161161
/// <inheritdoc/>
162162
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
163163
#else

src/Renci.SshNet/Common/SshData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ protected void Write(BigInteger data)
372372
/// <param name="data">name-list data to write.</param>
373373
protected void Write(string[] data)
374374
{
375-
#if NET || NETSTANDARD2_1
375+
#if NET
376376
Write(string.Join(',', data), Ascii);
377377
#else
378378
Write(string.Join(",", data), Ascii);

src/Renci.SshNet/Common/SshDataStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public bool IsEndOfData
5959
}
6060
}
6161

62-
#if NETFRAMEWORK || NETSTANDARD2_0
62+
#if !NET
6363
private void Write(ReadOnlySpan<byte> buffer)
6464
{
6565
var sharedBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(buffer.Length);
@@ -129,7 +129,7 @@ public void Write(string s, Encoding encoding)
129129
ThrowHelper.ThrowIfNull(s);
130130
ThrowHelper.ThrowIfNull(encoding);
131131

132-
#if NETSTANDARD2_1 || NET
132+
#if NET
133133
ReadOnlySpan<char> value = s;
134134
var count = encoding.GetByteCount(value);
135135
var bytes = count <= 256 ? stackalloc byte[count] : new byte[count];
@@ -220,7 +220,7 @@ public void WriteBinary(byte[] buffer, int offset, int count)
220220
/// </returns>
221221
public BigInteger ReadBigInt()
222222
{
223-
#if NETSTANDARD2_1 || NET
223+
#if NET
224224
var data = ReadBinarySegment();
225225
return new BigInteger(data, isBigEndian: true);
226226
#else

src/Renci.SshNet/Connection/ProxyConnector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ protected ProxyConnector(ISocketFactory socketFactory)
2121

2222
// ToDo: Performs async/sync fallback, true async version should be implemented in derived classes
2323
protected virtual
24-
#if NET || NETSTANDARD2_1
24+
#if NET
2525
async
2626
#endif
2727
Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, CancellationToken cancellationToken)
2828
{
2929
cancellationToken.ThrowIfCancellationRequested();
3030

31-
#if NET || NETSTANDARD2_1
31+
#if NET
3232
await using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
3333
#else
3434
using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false))
@@ -39,7 +39,7 @@ Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, Canc
3939
#pragma warning restore MA0042 // Do not use blocking calls in an async method
4040
}
4141

42-
#if !NET && !NETSTANDARD2_1
42+
#if !NET
4343
return Task.CompletedTask;
4444
#endif
4545
}

src/Renci.SshNet/Messages/Authentication/FailureMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected override void LoadData()
5555
PartialSuccess = ReadBoolean();
5656
if (PartialSuccess)
5757
{
58-
#if NET || NETSTANDARD2_1
58+
#if NET
5959
Message = string.Join(',', AllowedAuthentications);
6060
#else
6161
Message = string.Join(",", AllowedAuthentications);

0 commit comments

Comments
 (0)