Skip to content

Commit 5c4a0c8

Browse files
committed
Drop net6.0 target
1 parent 9c454ba commit 5c4a0c8

39 files changed

+76
-84
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

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: 1 addition & 1 deletion
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;

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_OR_GREATER || 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_OR_GREATER || 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/SshDataStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void Write(string s, Encoding encoding)
139139
{
140140
ThrowHelper.ThrowIfNull(encoding);
141141

142-
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
142+
#if NETSTANDARD2_1_OR_GREATER || NET
143143
ReadOnlySpan<char> value = s;
144144
var count = encoding.GetByteCount(value);
145145
var bytes = count <= 256 ? stackalloc byte[count] : new byte[count];
@@ -207,7 +207,7 @@ public BigInteger ReadBigInt()
207207
{
208208
var data = ReadBinary();
209209

210-
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
210+
#if NETSTANDARD2_1_OR_GREATER || NET
211211
return new BigInteger(data, isBigEndian: true);
212212
#else
213213
return new BigInteger(data.Reverse());

src/Renci.SshNet/Common/TaskToAsyncResult.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma warning disable
2-
#if !NET8_0_OR_GREATER
2+
#if !NET
33
// Copied verbatim from https://github.com/dotnet/runtime/blob/78bd7debe6d8b454294c673c9cb969c6b8a14692/src/libraries/Common/src/System/Threading/Tasks/TaskToAsyncResult.cs
44

55
// Licensed to the .NET Foundation under one or more agreements.
@@ -35,7 +35,7 @@ static class TaskToAsyncResult
3535
/// </remarks>
3636
public static IAsyncResult Begin(Task task, AsyncCallback? callback, object? state)
3737
{
38-
#if NET6_0_OR_GREATER
38+
#if NET
3939
ArgumentNullException.ThrowIfNull(task);
4040
#else
4141
if (task is null)
@@ -72,7 +72,7 @@ public static TResult End<TResult>(IAsyncResult asyncResult) =>
7272
/// <exception cref="ArgumentException"><paramref name="asyncResult"/> was not produced by a call to <see cref="Begin"/>.</exception>
7373
public static Task Unwrap(IAsyncResult asyncResult)
7474
{
75-
#if NET6_0_OR_GREATER
75+
#if NET
7676
ArgumentNullException.ThrowIfNull(asyncResult);
7777
#else
7878
if (asyncResult is null)
@@ -101,7 +101,7 @@ public static Task Unwrap(IAsyncResult asyncResult)
101101
/// </exception>
102102
public static Task<TResult> Unwrap<TResult>(IAsyncResult asyncResult)
103103
{
104-
#if NET6_0_OR_GREATER
104+
#if NET
105105
ArgumentNullException.ThrowIfNull(asyncResult);
106106
#else
107107
if (asyncResult is null)

src/Renci.SshNet/Common/ThrowHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal static class ThrowHelper
99
{
1010
public static void ThrowObjectDisposedIf(bool condition, object instance)
1111
{
12-
#if NET7_0_OR_GREATER
12+
#if NET
1313
ObjectDisposedException.ThrowIf(condition, instance);
1414
#else
1515
if (condition)
@@ -26,7 +26,7 @@ static void Throw(object? instance)
2626

2727
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
2828
{
29-
#if NET6_0_OR_GREATER
29+
#if NET
3030
ArgumentNullException.ThrowIfNull(argument, paramName);
3131
#else
3232
if (argument is null)
@@ -44,7 +44,7 @@ static void Throw(string? paramName)
4444

4545
public static void ThrowIfNullOrWhiteSpace([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
4646
{
47-
#if NET8_0_OR_GREATER
47+
#if NET
4848
ArgumentException.ThrowIfNullOrWhiteSpace(argument, paramName);
4949
#else
5050
if (string.IsNullOrWhiteSpace(argument))
@@ -63,7 +63,7 @@ static void Throw(string? argument, string? paramName)
6363

6464
public static void ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
6565
{
66-
#if NET7_0_OR_GREATER
66+
#if NET
6767
ArgumentException.ThrowIfNullOrEmpty(argument, paramName);
6868
#else
6969
if (string.IsNullOrEmpty(argument))

src/Renci.SshNet/Compression/Zlib.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.IO;
2-
#if NET6_0_OR_GREATER
2+
#if NET
33
using System.IO.Compression;
44
#else
55
using Org.BouncyCastle.Utilities.Zlib;
@@ -14,7 +14,7 @@ namespace Renci.SshNet.Compression
1414
public class Zlib : Compressor
1515
#pragma warning restore CA1724 // Type names should not match namespaces
1616
{
17-
#if NET6_0_OR_GREATER
17+
#if NET
1818
private readonly ZLibStream _compressor;
1919
private readonly ZLibStream _decompressor;
2020
#else
@@ -45,7 +45,7 @@ protected Zlib(bool delayedCompression)
4545
_compressorStream = new MemoryStream();
4646
_decompressorStream = new MemoryStream();
4747

48-
#if NET6_0_OR_GREATER
48+
#if NET
4949
_compressor = new ZLibStream(_compressorStream, CompressionMode.Compress);
5050
_decompressor = new ZLibStream(_decompressorStream, CompressionMode.Decompress);
5151
#else
@@ -74,7 +74,7 @@ protected override byte[] CompressCore(byte[] data, int offset, int length)
7474
/// <inheritdoc/>
7575
protected override byte[] DecompressCore(byte[] data, int offset, int length)
7676
{
77-
#if NET6_0_OR_GREATER
77+
#if NET
7878
_decompressorStream.Write(data, offset, length);
7979
_decompressorStream.Position = 0;
8080

0 commit comments

Comments
 (0)