-
-
Notifications
You must be signed in to change notification settings - Fork 971
Add .NET 10 target and make use of C#14 extension members #1672
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8ca64e6
Add .NET 10 target
mus65 cd391cb
fix IDE0031
mus65 fddb6e3
fix ca5399
mus65 bffe6a1
fix ca1515
mus65 c8fd34f
fix ca2002
mus65 4d1351a
fix ca1508
mus65 d2f660d
fix ca2000
mus65 6e9e74a
fix ca2025
mus65 76383f5
fix ca1849
mus65 d1b7291
fix Reverse() overloads
mus65 c0b525f
supress CA2002
mus65 a0a67e0
Use extension members for ThrowHelpers
mus65 6f8a60e
use extension members for CryptoAbstractions
mus65 b70f75e
use extension member for DateTime.UnixEpoch
mus65 7bc2828
use extension members for string.Join etc
mus65 7a836ae
use extension members for Convert.To/FromHexString
mus65 4211159
disable CA1508
mus65 8d5f47b
Merge remote-tracking branch 'upstream/develop' into net10
mus65 3454410
Merge remote-tracking branch 'upstream/develop' into net10
mus65 06ea59e
Update .NET 10 RC2
mus65 5a59ac9
Workaround Build Regression in .NET 10 RC2
mus65 76332f3
Merge remote-tracking branch 'upstream/develop' into net10
mus65 f55a8ae
suppress new warnings introduced by merge
mus65 a83ad5d
Merge remote-tracking branch 'upstream/develop' into net10
mus65 c93f536
Update to .NET 10 final release
mus65 1bdad1c
Revert "Workaround Build Regression in .NET 10 RC2"
mus65 52f30b8
Merge remote-tracking branch 'upstream/develop' into net10
mus65 6c3c06d
fix new warnings with MSTest 4 + .NET 10
mus65 327e6c6
use same Randomizer instance
mus65 5e7d01d
disable CA2000
mus65 fdd1dac
reduce CA1849 suppressions
mus65 9f19333
disable preview analyzers
mus65 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "9.0.300", | ||
| "version": "10.0.100", | ||
| "rollForward": "latestFeature" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #nullable enable | ||
| #if !NET | ||
| using System.Text; | ||
| #endif | ||
|
|
||
| namespace System | ||
| { | ||
| internal static class ConvertExtensions | ||
| { | ||
| extension(Convert) | ||
| { | ||
| #if !NET | ||
| public static byte[] FromHexString(string s) | ||
| { | ||
| return Org.BouncyCastle.Utilities.Encoders.Hex.Decode(s); | ||
| } | ||
|
|
||
| public static string ToHexString(byte[] inArray) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(inArray); | ||
|
|
||
| var builder = new StringBuilder(inArray.Length * 2); | ||
|
|
||
| foreach (var b in inArray) | ||
| { | ||
| builder.Append(b.ToString("X2")); | ||
| } | ||
|
|
||
| return builder.ToString(); | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #nullable enable | ||
| namespace System | ||
| { | ||
| internal static class DateTimeExtensions | ||
| { | ||
| extension(DateTime) | ||
| { | ||
| #if !NET | ||
| public static DateTime UnixEpoch | ||
| { | ||
| get | ||
| { | ||
| return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #nullable enable | ||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class MD5Extensions | ||
| { | ||
| extension(MD5) | ||
| { | ||
| #if !NET | ||
| public static byte[] HashData(byte[] source) | ||
| { | ||
| using (var md5 = MD5.Create()) | ||
| { | ||
| return md5.ComputeHash(source); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
src/Renci.SshNet/Abstractions/RandomNumberGeneratorExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #nullable enable | ||
| #if !NET | ||
| using Renci.SshNet.Abstractions; | ||
| #endif | ||
|
|
||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class RandomNumberGeneratorExtensions | ||
| { | ||
| extension(RandomNumberGenerator) | ||
| { | ||
| #if !NET | ||
| public static byte[] GetBytes(int length) | ||
| { | ||
| var random = new byte[length]; | ||
| CryptoAbstraction.Randomizer.GetBytes(random); | ||
| return random; | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class SHA1Extensions | ||
| { | ||
| extension(SHA1) | ||
| { | ||
| #if !NET | ||
| public static byte[] HashData(byte[] source) | ||
| { | ||
| using (var sha1 = SHA1.Create()) | ||
| { | ||
| return sha1.ComputeHash(source); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #nullable enable | ||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class SHA256Extensions | ||
| { | ||
| extension(SHA256) | ||
| { | ||
| #if !NET | ||
| public static byte[] HashData(byte[] source) | ||
| { | ||
| using (var sha256 = SHA256.Create()) | ||
| { | ||
| return sha256.ComputeHash(source); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #nullable enable | ||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class SHA384Extensions | ||
| { | ||
| extension(SHA384) | ||
| { | ||
| #if !NET | ||
| public static byte[] HashData(byte[] source) | ||
| { | ||
| using (var sha384 = SHA384.Create()) | ||
| { | ||
| return sha384.ComputeHash(source); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #nullable enable | ||
| namespace System.Security.Cryptography | ||
| { | ||
| internal static class SHA512Extensions | ||
| { | ||
| extension(SHA512) | ||
| { | ||
| #if !NET | ||
| public static byte[] HashData(byte[] source) | ||
| { | ||
| using (var sha512 = SHA512.Create()) | ||
| { | ||
| return sha512.ComputeHash(source); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.