diff --git a/.editorconfig b/.editorconfig index 57b9fa6c0..899395944 100644 --- a/.editorconfig +++ b/.editorconfig @@ -847,6 +847,11 @@ dotnet_diagnostic.IDE0300.severity = none # TODO: Discuss whether we want to start using this dotnet_diagnostic.IDE0301.severity = none +# IDE0370: Remove unnecessary suppression +# +# This can lead to many false positives in different target frameworks. +dotnet_diagnostic.IDE0370.severity = suggestion + #### .NET Compiler Platform code style rules #### ### Language rules ### diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd49e0600..4e83eaa2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.201' - name: Build Unit Tests .NET run: dotnet build -f net10.0 test/Renci.SshNet.Tests/ @@ -63,6 +65,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.201' - name: Build Solution run: dotnet build Renci.SshNet.slnx @@ -114,6 +118,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.201' - name: Setup WSL2 uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0 @@ -156,6 +162,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.201' - name: Setup WSL2 uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0 diff --git a/src/Renci.SshNet/ForwardedPort.cs b/src/Renci.SshNet/ForwardedPort.cs index 6440c7476..00a0c8c30 100644 --- a/src/Renci.SshNet/ForwardedPort.cs +++ b/src/Renci.SshNet/ForwardedPort.cs @@ -105,10 +105,7 @@ protected virtual void StopPort(TimeSpan timeout) RaiseClosing(); var session = Session; - if (session is not null) - { - session.ErrorOccured -= Session_ErrorOccurred; - } + session?.ErrorOccured -= Session_ErrorOccurred; } /// diff --git a/src/Renci.SshNet/OrderedDictionary.netstandard.cs b/src/Renci.SshNet/OrderedDictionary.netstandard.cs index 365920aec..4ff15442a 100644 --- a/src/Renci.SshNet/OrderedDictionary.netstandard.cs +++ b/src/Renci.SshNet/OrderedDictionary.netstandard.cs @@ -234,7 +234,7 @@ public bool Remove(TKey key, [MaybeNullWhen(false)] out TValue value) } AssertConsistency(); - value = default!; + value = default; return false; } diff --git a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs index 39a779a39..366996984 100644 --- a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs @@ -1,5 +1,7 @@ -using Renci.SshNet.Abstractions; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Abstractions; + using System; using System.Threading; using System.Security.Cryptography;