Skip to content

Commit 86dc811

Browse files
mus65Rob-Hague
andauthored
Drop net6.0 target (#1580)
* Drop net6.0 target * Update src/Renci.SshNet/Common/TaskToAsyncResult.cs Co-authored-by: Rob Hague <rob.hague00@gmail.com> * remove redundant #if for some reason this made the compiler suddenly realize that the plain text variables are unused. * use TargetFrameworkIdentifier this doesn't work in Directory.Build.props, moved it to Directory.Build.targets. * fix null reference warnings in Benchmarks seems like the warnings were (somehow) disabled here before and were fixed by the previous TargetFrameworkIdentifier change. * fix unused plainTextOffset in AesGcmCipher.BclImpl * CI retry * more cosmetics * more * update README * Revert "use TargetFrameworkIdentifier" This reverts commit 076ede1. --------- Co-authored-by: Rob Hague <rob.hague00@gmail.com> Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
1 parent 99ef23c commit 86dc811

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+110
-133
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<!--
3232
Disable nullable warnings on old frameworks because of missing annotations.
3333
-->
34-
<PropertyGroup Condition=" !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0')) ">
34+
<PropertyGroup Condition=" !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) ">
3535
<NoWarn>$(NoWarn);CS8602;CS8604;CS8777</NoWarn>
3636
</PropertyGroup>
3737

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Private keys in PuTTY private key format can be encrypted using the following ci
181181
**SSH.NET** supports the following target frameworks:
182182
* .NETFramework 4.6.2 (and higher)
183183
* .NET Standard 2.0 and 2.1
184-
* .NET 6 (and higher)
184+
* .NET 8 (and higher)
185185

186186
## Building the library
187187

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
#if !NET
12
using System.Threading;
23
using System.Threading.Tasks;
34

45
namespace Renci.SshNet.Abstractions
56
{
67
internal static class CancellationTokenSourceExtensions
78
{
8-
#if !NET8_OR_GREATER
99
public static Task CancelAsync(this CancellationTokenSource cancellationTokenSource)
1010
{
1111
cancellationTokenSource.Cancel();
1212
return Task.CompletedTask;
1313
}
14-
#endif
1514
}
1615
}
16+
#endif

src/Renci.SshNet/Abstractions/SocketAbstraction.Async.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET6_0_OR_GREATER
1+
#if NET
22

33
using System;
44
using System.Diagnostics;
@@ -47,4 +47,4 @@ static async ValueTask SendAsyncCore(Socket socket, ReadOnlyMemory<byte> data, C
4747
}
4848
}
4949
}
50-
#endif // NET6_0_OR_GREATER
50+
#endif // NET

src/Renci.SshNet/Abstractions/SocketAbstraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public static int Read(Socket socket, byte[] buffer, int offset, int size, TimeS
311311
return totalBytesRead;
312312
}
313313

314-
#if NET6_0_OR_GREATER == false
314+
#if !NET
315315
public static Task<int> ReadAsync(Socket socket, byte[] buffer, CancellationToken cancellationToken)
316316
{
317317
return socket.ReceiveAsync(buffer, 0, buffer.Length, cancellationToken);

src/Renci.SshNet/Abstractions/SocketExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !NET6_0_OR_GREATER
1+
#if !NET
22
using System;
33
using System.Net;
44
using System.Net.Sockets;
@@ -93,11 +93,11 @@ public static async Task ConnectAsync(this Socket socket, EndPoint remoteEndpoin
9393
{
9494
args.RemoteEndPoint = remoteEndpoint;
9595

96-
#if NET || NETSTANDARD2_1_OR_GREATER
96+
#if NETSTANDARD2_1
9797
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
9898
#else
9999
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
100-
#endif // NET || NETSTANDARD2_1_OR_GREATER
100+
#endif
101101
{
102102
await args.ExecuteAsync(socket.ConnectAsync);
103103
}
@@ -112,11 +112,11 @@ public static async Task<int> ReceiveAsync(this Socket socket, byte[] buffer, in
112112
{
113113
args.SetBuffer(buffer, offset, length);
114114

115-
#if NET || NETSTANDARD2_1_OR_GREATER
115+
#if NETSTANDARD2_1
116116
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
117117
#else
118118
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
119-
#endif // NET || NETSTANDARD2_1_OR_GREATER
119+
#endif
120120
{
121121
await args.ExecuteAsync(socket.ReceiveAsync);
122122
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
#if !NET && !NETSTANDARD2_1_OR_GREATER
1+
#if NETFRAMEWORK || NETSTANDARD2_0
22
using System.IO;
33
using System.Threading.Tasks;
4-
#endif
54

65
namespace Renci.SshNet.Abstractions
76
{
87
internal static class StreamExtensions
98
{
10-
#if !NET && !NETSTANDARD2_1_OR_GREATER
119
public static ValueTask DisposeAsync(this Stream stream)
1210
{
1311
stream.Dispose();
1412
return default;
1513
}
16-
#endif
1714
}
1815
}
16+
#endif

src/Renci.SshNet/ClientAuthentication.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ 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_OR_GREATER
108+
#if NET || NETSTANDARD2_1
109109
string.Join(',', allowedAuthenticationMethods)))
110110
#else
111111
string.Join(",", allowedAuthenticationMethods)))
112-
#endif // NET || NETSTANDARD2_1_OR_GREATER
112+
#endif
113113
;
114114
return false;
115115
}

src/Renci.SshNet/Common/Extensions.cs

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

4949
internal static BigInteger ToBigInteger(this byte[] data)
5050
{
51-
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
51+
#if NETSTANDARD2_1 || NET
5252
return new BigInteger(data, isBigEndian: true);
5353
#else
5454
var reversed = new byte[data.Length];
@@ -62,7 +62,7 @@ internal static BigInteger ToBigInteger(this byte[] data)
6262
/// </summary>
6363
public static BigInteger ToBigInteger2(this byte[] data)
6464
{
65-
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
65+
#if NETSTANDARD2_1 || NET
6666
return new BigInteger(data, isBigEndian: true, isUnsigned: true);
6767
#else
6868
if ((data[0] & (1 << 7)) != 0)
@@ -95,7 +95,7 @@ public static byte[] ToByteArray(this BigInteger bigInt, bool isUnsigned = false
9595
}
9696
#endif
9797

98-
#if !NET6_0_OR_GREATER
98+
#if !NET
9999
public static long GetBitLength(this BigInteger bigint)
100100
{
101101
// Taken from https://github.com/dotnet/runtime/issues/31308

src/Renci.SshNet/Common/SshData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,11 @@ 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_OR_GREATER
375+
#if NET || NETSTANDARD2_1
376376
Write(string.Join(',', data), Ascii);
377377
#else
378378
Write(string.Join(",", data), Ascii);
379-
#endif // NET || NETSTANDARD2_1_OR_GREATER
379+
#endif
380380
}
381381

382382
/// <summary>

0 commit comments

Comments
 (0)