From a06527b88c9673f399f8a51c0b19cfbfaba8572c Mon Sep 17 00:00:00 2001 From: Sebastian Krysmanski Date: Mon, 4 Mar 2024 09:48:45 +0100 Subject: [PATCH 1/4] Switch to .NET 8 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index a676afae..a76f17de 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ - net7.0 + net8.0 From d65c9228d12bc6541d846f2618f521db52e5e4e8 Mon Sep 17 00:00:00 2001 From: Sebastian Krysmanski Date: Mon, 4 Mar 2024 15:59:45 +0100 Subject: [PATCH 2/4] Update CA to 8.0.0 --- _ProjectCommons | 2 +- src/AppMotor.CliApp/CommandLine/CliParam.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_ProjectCommons b/_ProjectCommons index 8654ee11..eabf474e 160000 --- a/_ProjectCommons +++ b/_ProjectCommons @@ -1 +1 @@ -Subproject commit 8654ee11461ccb3bf186d660f4fb260ca551a47a +Subproject commit eabf474e88aaf695dc0223544efe857ca675cd54 diff --git a/src/AppMotor.CliApp/CommandLine/CliParam.cs b/src/AppMotor.CliApp/CommandLine/CliParam.cs index a0da772b..e34f2e15 100644 --- a/src/AppMotor.CliApp/CommandLine/CliParam.cs +++ b/src/AppMotor.CliApp/CommandLine/CliParam.cs @@ -125,7 +125,8 @@ public CliParam(string name, int positionIndex) } } - private Symbol CreateUnderlyingNamedParameter() + [MustUseReturnValue] + private Option CreateUnderlyingNamedParameter() { Option option; @@ -148,7 +149,8 @@ private Symbol CreateUnderlyingNamedParameter() return option; } - private Symbol CreateUnderlyingPositionalParameter() + [MustUseReturnValue] + private Argument CreateUnderlyingPositionalParameter() { var argument = new Argument(this.PrimaryName, this.HelpText); From e3e85bd28d2679e584c5d6426bd48c7f28c98f2c Mon Sep 17 00:00:00 2001 From: Sebastian Krysmanski Date: Mon, 4 Mar 2024 16:16:41 +0100 Subject: [PATCH 3/4] Adopt new C# 12 features --- _ProjectCommons | 2 +- .../Models/ToDoItem.cs | 1 + src/AppMotor.CliApp/Terminals/ITerminal.cs | 4 +-- .../SensitiveValues/SensitiveValue.cs | 8 ++--- .../DataModel/TypeMarkers/TypeMarker.cs | 6 ++-- .../Events/IEventHandlerRegistration.cs | 4 +-- .../ICollectionIsReadOnlyException.cs | 4 +-- .../UninitializedStructPropertyException.cs | 4 +-- .../Logging/SimpleLoggableValue.cs | 8 ++--- .../IsExternalInit.cs | 4 +-- .../Tests/CliApplicationExecutorTests.cs | 14 ++++----- .../CommandLine/CliCommandExecutorTests.cs | 30 +++++++++---------- .../Formatting/AnsiColorStreamParserTests.cs | 5 +--- .../Exceptions/ExceptionDataAccessorTests.cs | 6 ++-- .../Tests/Extensions/TypeExtensionsTests.cs | 15 ++-------- .../Tests/Logging/LoggableValuesTests.cs | 20 ++++--------- .../Tests/Utils/DisposeHelperTests.cs | 5 +--- .../Utils/PooledArrayBufferWriterTests.cs | 1 + .../Tests/HttpTests.cs | 2 +- .../Tests/HttpsTests.cs | 2 +- .../Tests/IpVersionTests.cs | 2 +- 21 files changed, 53 insertions(+), 94 deletions(-) diff --git a/_ProjectCommons b/_ProjectCommons index eabf474e..d2bcbac2 160000 --- a/_ProjectCommons +++ b/_ProjectCommons @@ -1 +1 @@ -Subproject commit eabf474e88aaf695dc0223544efe857ca675cd54 +Subproject commit d2bcbac2551ec840871a186ac900e1efeec80773 diff --git a/samples/AppMotor.HttpServer.WebApiSample/Models/ToDoItem.cs b/samples/AppMotor.HttpServer.WebApiSample/Models/ToDoItem.cs index 0f6818db..e37d29d1 100644 --- a/samples/AppMotor.HttpServer.WebApiSample/Models/ToDoItem.cs +++ b/samples/AppMotor.HttpServer.WebApiSample/Models/ToDoItem.cs @@ -6,6 +6,7 @@ namespace AppMotor.HttpServer.WebApiSample.Models; public sealed class TodoItem { public long Id { get; set; } + // ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength public string? Name { get; set; } public bool IsComplete { get; set; } } diff --git a/src/AppMotor.CliApp/Terminals/ITerminal.cs b/src/AppMotor.CliApp/Terminals/ITerminal.cs index 17874c3f..ccfa321d 100644 --- a/src/AppMotor.CliApp/Terminals/ITerminal.cs +++ b/src/AppMotor.CliApp/Terminals/ITerminal.cs @@ -16,6 +16,4 @@ namespace AppMotor.CliApp.Terminals; /// Instances of this interface may or may not also implement . You can use an /// "is"/"as" conversion to check for this and adopt your code accordingly. /// -public interface ITerminal : ITerminalInput, ITerminalOutput -{ -} +public interface ITerminal : ITerminalInput, ITerminalOutput; diff --git a/src/AppMotor.Core/DataModel/SensitiveValues/SensitiveValue.cs b/src/AppMotor.Core/DataModel/SensitiveValues/SensitiveValue.cs index d0b06484..6c94448b 100644 --- a/src/AppMotor.Core/DataModel/SensitiveValues/SensitiveValue.cs +++ b/src/AppMotor.Core/DataModel/SensitiveValues/SensitiveValue.cs @@ -9,14 +9,10 @@ namespace AppMotor.Core.DataModel; /// by accident. /// /// -public interface ISensitiveValue -{ -} +public interface ISensitiveValue; /// /// A alternative to . /// // ReSharper disable once ClassNeverInstantiated.Global -public sealed class SensitiveValueMarker : TypeMarker -{ -} +public sealed class SensitiveValueMarker : TypeMarker; diff --git a/src/AppMotor.Core/DataModel/TypeMarkers/TypeMarker.cs b/src/AppMotor.Core/DataModel/TypeMarkers/TypeMarker.cs index 4b87bba9..1851d160 100644 --- a/src/AppMotor.Core/DataModel/TypeMarkers/TypeMarker.cs +++ b/src/AppMotor.Core/DataModel/TypeMarkers/TypeMarker.cs @@ -5,11 +5,9 @@ namespace AppMotor.Core.DataModel; /// /// Represents a type marker; that is a way of marking certain .NET s in a -/// generic way. The main use case here is provide an alternative to marker interfaces when +/// generic way. The main use case here is to provide an alternative to marker interfaces when /// you can't change the implementation of an existing type you wish to mark. For example, /// if you can't implement the marker interface , you can instead /// mark the type with (via ). /// -public abstract class TypeMarker -{ -} +public abstract class TypeMarker; diff --git a/src/AppMotor.Core/Events/IEventHandlerRegistration.cs b/src/AppMotor.Core/Events/IEventHandlerRegistration.cs index 0efd3e64..7d15b299 100644 --- a/src/AppMotor.Core/Events/IEventHandlerRegistration.cs +++ b/src/AppMotor.Core/Events/IEventHandlerRegistration.cs @@ -7,6 +7,4 @@ namespace AppMotor.Core.Events; /// A registration for . Dispose this registration /// to remove/delete the registration. /// -public interface IEventHandlerRegistration : IDisposable -{ -} +public interface IEventHandlerRegistration : IDisposable; diff --git a/src/AppMotor.Core/Exceptions/ICollectionIsReadOnlyException.cs b/src/AppMotor.Core/Exceptions/ICollectionIsReadOnlyException.cs index 9f8bfdcf..cff8bef9 100644 --- a/src/AppMotor.Core/Exceptions/ICollectionIsReadOnlyException.cs +++ b/src/AppMotor.Core/Exceptions/ICollectionIsReadOnlyException.cs @@ -8,6 +8,4 @@ namespace AppMotor.Core.Exceptions; /// and its variants. Via this interface on can catch all related /// exceptions in one catch block. /// -public interface ICollectionIsReadOnlyException -{ -} +public interface ICollectionIsReadOnlyException; diff --git a/src/AppMotor.Core/Exceptions/UninitializedStructPropertyException.cs b/src/AppMotor.Core/Exceptions/UninitializedStructPropertyException.cs index 4844b77f..dfa9fb74 100644 --- a/src/AppMotor.Core/Exceptions/UninitializedStructPropertyException.cs +++ b/src/AppMotor.Core/Exceptions/UninitializedStructPropertyException.cs @@ -9,6 +9,4 @@ namespace AppMotor.Core.Exceptions; /// Thrown if you try to access properties of an uninitialized struct. /// [PublicAPI] -public class UninitializedStructPropertyException : InvalidOperationException -{ -} +public class UninitializedStructPropertyException : InvalidOperationException; diff --git a/src/AppMotor.Core/Logging/SimpleLoggableValue.cs b/src/AppMotor.Core/Logging/SimpleLoggableValue.cs index fdf12c65..e5d10635 100644 --- a/src/AppMotor.Core/Logging/SimpleLoggableValue.cs +++ b/src/AppMotor.Core/Logging/SimpleLoggableValue.cs @@ -12,14 +12,10 @@ namespace AppMotor.Core.Logging; /// and therefor in . /// /// -public interface ISimpleLoggableValue -{ -} +public interface ISimpleLoggableValue; /// /// A alternative to . /// // ReSharper disable once ClassNeverInstantiated.Global -public sealed class SimpleLoggableValueMarker : TypeMarker -{ -} +public sealed class SimpleLoggableValueMarker : TypeMarker; diff --git a/src/AppMotor.NetStandardCompat/IsExternalInit.cs b/src/AppMotor.NetStandardCompat/IsExternalInit.cs index 8031637c..7772d6b3 100644 --- a/src/AppMotor.NetStandardCompat/IsExternalInit.cs +++ b/src/AppMotor.NetStandardCompat/IsExternalInit.cs @@ -13,6 +13,4 @@ namespace System.Runtime.CompilerServices; /// [UsedImplicitly] [EditorBrowsable(EditorBrowsableState.Never)] -public sealed class IsExternalInit -{ -} +public sealed class IsExternalInit; diff --git a/tests/AppMotor.CliApp.Tests/Tests/CliApplicationExecutorTests.cs b/tests/AppMotor.CliApp.Tests/Tests/CliApplicationExecutorTests.cs index c8f266ed..0de2d89f 100644 --- a/tests/AppMotor.CliApp.Tests/Tests/CliApplicationExecutorTests.cs +++ b/tests/AppMotor.CliApp.Tests/Tests/CliApplicationExecutorTests.cs @@ -19,7 +19,7 @@ namespace AppMotor.CliApp.Tests; /// public sealed class CliApplicationExecutorTests { - private static readonly string[] TEST_ARGS = { "abc", "def" }; + private static readonly string[] TEST_ARGS = ["abc", "def"]; [Fact] public void Test_Sync_Void_NoArgs_NoCancellationToken() @@ -403,7 +403,7 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" } @@ -433,7 +433,7 @@ async Task Execute(string[] args, CancellationToken cancellationToken) args.ShouldBe(TEST_ARGS); cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" } @@ -515,7 +515,7 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } @@ -548,7 +548,7 @@ async Task Execute(string[] args, CancellationToken cancellationToken) args.ShouldBe(TEST_ARGS); cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } @@ -634,7 +634,7 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } @@ -668,7 +668,7 @@ async Task Execute(string[] args, CancellationToken cancellationToken) args.ShouldBe(TEST_ARGS); cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } diff --git a/tests/AppMotor.CliApp.Tests/Tests/CommandLine/CliCommandExecutorTests.cs b/tests/AppMotor.CliApp.Tests/Tests/CommandLine/CliCommandExecutorTests.cs index ab8e57bc..20c51b7c 100644 --- a/tests/AppMotor.CliApp.Tests/Tests/CommandLine/CliCommandExecutorTests.cs +++ b/tests/AppMotor.CliApp.Tests/Tests/CommandLine/CliCommandExecutorTests.cs @@ -36,7 +36,7 @@ void Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: 0); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: 0); // Verify called.ShouldBe(true); @@ -63,7 +63,7 @@ void Execute(CancellationToken cancellationToken) var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: 0, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: 0, cts.Token); // Verify called.ShouldBe(true); @@ -87,7 +87,7 @@ bool Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal ? 0 : 1); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal ? 0 : 1); // Verify called.ShouldBe(true); @@ -117,7 +117,7 @@ bool Execute(CancellationToken cancellationToken) var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal ? 0 : 1, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal ? 0 : 1, cts.Token); // Verify called.ShouldBe(true); @@ -142,7 +142,7 @@ int Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal); // Verify called.ShouldBe(true); @@ -173,7 +173,7 @@ int Execute(CancellationToken cancellationToken) var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal, cts.Token); // Verify called.ShouldBe(true); @@ -195,7 +195,7 @@ async Task Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: 0); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: 0); // Verify called.ShouldBe(true); @@ -217,14 +217,14 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" } var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: 0, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: 0, cts.Token); // Verify called.ShouldBe(true); @@ -249,7 +249,7 @@ async Task Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal ? 0 : 1); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal ? 0 : 1); // Verify called.ShouldBe(true); @@ -273,7 +273,7 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } @@ -281,7 +281,7 @@ async Task Execute(CancellationToken cancellationToken) var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal ? 0 : 1, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal ? 0 : 1, cts.Token); // Verify called.ShouldBe(true); @@ -307,7 +307,7 @@ async Task Execute() var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal); // Verify called.ShouldBe(true); @@ -332,7 +332,7 @@ async Task Execute(CancellationToken cancellationToken) called = true; cancellationToken.IsCancellationRequested.ShouldBe(false); // ReSharper disable once AccessToDisposedClosure - cts.Cancel(); + await cts.CancelAsync(); cancellationToken.IsCancellationRequested.ShouldBe(true); // Validates we actually got the token from "cts" return retVal; } @@ -340,7 +340,7 @@ async Task Execute(CancellationToken cancellationToken) var testApplication = new TestApplication(new CliCommandExecutor(Execute)); // Test - testApplication.AppHelper.Run(new[] { COMMAND_NAME }, expectedExitCode: retVal, cts.Token); + testApplication.AppHelper.Run([COMMAND_NAME], expectedExitCode: retVal, cts.Token); // Verify called.ShouldBe(true); diff --git a/tests/AppMotor.CliApp.Tests/Tests/Terminals/Formatting/AnsiColorStreamParserTests.cs b/tests/AppMotor.CliApp.Tests/Tests/Terminals/Formatting/AnsiColorStreamParserTests.cs index 09a02f32..34c8cab1 100644 --- a/tests/AppMotor.CliApp.Tests/Tests/Terminals/Formatting/AnsiColorStreamParserTests.cs +++ b/tests/AppMotor.CliApp.Tests/Tests/Terminals/Formatting/AnsiColorStreamParserTests.cs @@ -431,10 +431,7 @@ protected override void OnNonColorAnsiEscapeSequence(ReadOnlySpan escapeSe } } - private interface IParsedItem - { - - } + private interface IParsedItem; private sealed class ParsedTextItem : IParsedItem, IEquatable { diff --git a/tests/AppMotor.Core.Tests/Tests/Exceptions/ExceptionDataAccessorTests.cs b/tests/AppMotor.Core.Tests/Tests/Exceptions/ExceptionDataAccessorTests.cs index 77d0f395..a7aa7dd5 100644 --- a/tests/AppMotor.Core.Tests/Tests/Exceptions/ExceptionDataAccessorTests.cs +++ b/tests/AppMotor.Core.Tests/Tests/Exceptions/ExceptionDataAccessorTests.cs @@ -69,7 +69,8 @@ public void TestNullData() Should.NotThrow(() => accessor.Clear()); // Enumeration is empty. - accessor.GetEnumerator().MoveNext().ShouldBe(false); + using var enumerator = accessor.GetEnumerator(); + enumerator.MoveNext().ShouldBe(false); } [Fact] @@ -94,7 +95,8 @@ public void TestReadOnlyData() Should.NotThrow(() => accessor.Clear()); // Enumeration is empty. - accessor.GetEnumerator().MoveNext().ShouldBe(false); + using var enumerator = accessor.GetEnumerator(); + enumerator.MoveNext().ShouldBe(false); } [Fact] diff --git a/tests/AppMotor.Core.Tests/Tests/Extensions/TypeExtensionsTests.cs b/tests/AppMotor.Core.Tests/Tests/Extensions/TypeExtensionsTests.cs index 9392d3b2..8895e65c 100644 --- a/tests/AppMotor.Core.Tests/Tests/Extensions/TypeExtensionsTests.cs +++ b/tests/AppMotor.Core.Tests/Tests/Extensions/TypeExtensionsTests.cs @@ -124,20 +124,11 @@ public void Test_Is() typeof(object).Is(typeof(ITestInterface)).ShouldBe(false); } - private interface ITestInterface - { + private interface ITestInterface; - } + private class ClassA : ITestInterface; - private class ClassA : ITestInterface - { - - } - - private class ClassB : ClassA - { - - } + private class ClassB : ClassA; [Theory] [InlineData("+", UnaryOperators.UnaryPlus)] diff --git a/tests/AppMotor.Core.Tests/Tests/Logging/LoggableValuesTests.cs b/tests/AppMotor.Core.Tests/Tests/Logging/LoggableValuesTests.cs index c83413a6..c5090e6e 100644 --- a/tests/AppMotor.Core.Tests/Tests/Logging/LoggableValuesTests.cs +++ b/tests/AppMotor.Core.Tests/Tests/Logging/LoggableValuesTests.cs @@ -79,23 +79,13 @@ public void TestIsSimpleLoggableType() LoggableValues.IsSimpleLoggableType(typeof(MyCustomSensitiveType2)).ShouldBe(false); } - private enum MyEnum - { - } + private enum MyEnum; - private sealed class MyCustomLoggableType1 : ISimpleLoggableValue - { - } + private sealed class MyCustomLoggableType1 : ISimpleLoggableValue; - private sealed class MyCustomLoggableType2 - { - } + private sealed class MyCustomLoggableType2; - private sealed class MyCustomSensitiveType1 : ISimpleLoggableValue, ISensitiveValue - { - } + private sealed class MyCustomSensitiveType1 : ISimpleLoggableValue, ISensitiveValue; - private sealed class MyCustomSensitiveType2 : ISimpleLoggableValue - { - } + private sealed class MyCustomSensitiveType2 : ISimpleLoggableValue; } diff --git a/tests/AppMotor.Core.Tests/Tests/Utils/DisposeHelperTests.cs b/tests/AppMotor.Core.Tests/Tests/Utils/DisposeHelperTests.cs index 0b0da8bd..7ee71d16 100644 --- a/tests/AppMotor.Core.Tests/Tests/Utils/DisposeHelperTests.cs +++ b/tests/AppMotor.Core.Tests/Tests/Utils/DisposeHelperTests.cs @@ -37,8 +37,5 @@ public async Task Test_DisposeWithAsyncSupport_WithoutAsyncDisposable() } [UsedImplicitly(ImplicitUseKindFlags.Access)] - public interface IMixedDisposable : IDisposable, IAsyncDisposable - { - - } + public interface IMixedDisposable : IDisposable, IAsyncDisposable; } diff --git a/tests/AppMotor.Core.Tests/Tests/Utils/PooledArrayBufferWriterTests.cs b/tests/AppMotor.Core.Tests/Tests/Utils/PooledArrayBufferWriterTests.cs index 80bbe512..a27db700 100644 --- a/tests/AppMotor.Core.Tests/Tests/Utils/PooledArrayBufferWriterTests.cs +++ b/tests/AppMotor.Core.Tests/Tests/Utils/PooledArrayBufferWriterTests.cs @@ -88,6 +88,7 @@ public void Test_Clear() bufferWriter.WrittenMemory.ShouldBe(new[] { 0, 0, 0 }); // Dispose tests + // ReSharper disable once DisposeOnUsingVariable bufferWriter.Dispose(); Should.Throw(() => bufferWriter.Clear()); } diff --git a/tests/AppMotor.HttpServer.Tests/Tests/HttpTests.cs b/tests/AppMotor.HttpServer.Tests/Tests/HttpTests.cs index f49af112..3d05bce2 100644 --- a/tests/AppMotor.HttpServer.Tests/Tests/HttpTests.cs +++ b/tests/AppMotor.HttpServer.Tests/Tests/HttpTests.cs @@ -52,7 +52,7 @@ public async Task TestHttpApiCall() responseString.ShouldBe("Hello World!"); } - cts.Cancel(); + await cts.CancelAsync(); await TestTimeout.TimeoutAfter(appTask, TimeSpan.FromSeconds(10)); } diff --git a/tests/AppMotor.HttpServer.Tests/Tests/HttpsTests.cs b/tests/AppMotor.HttpServer.Tests/Tests/HttpsTests.cs index 687f3486..718debb0 100644 --- a/tests/AppMotor.HttpServer.Tests/Tests/HttpsTests.cs +++ b/tests/AppMotor.HttpServer.Tests/Tests/HttpsTests.cs @@ -57,7 +57,7 @@ public async Task TestHttpsApiCall() responseString.ShouldBe("Hello World!"); } - cts.Cancel(); + await cts.CancelAsync(); await TestTimeout.TimeoutAfter(appTask, TimeSpan.FromSeconds(10)); } diff --git a/tests/AppMotor.HttpServer.Tests/Tests/IpVersionTests.cs b/tests/AppMotor.HttpServer.Tests/Tests/IpVersionTests.cs index c606d953..53b7b951 100644 --- a/tests/AppMotor.HttpServer.Tests/Tests/IpVersionTests.cs +++ b/tests/AppMotor.HttpServer.Tests/Tests/IpVersionTests.cs @@ -110,7 +110,7 @@ public async Task TestConnection(SocketListenAddresses listenAddress, IPVersions { this.TestConsole.WriteLine(); - cts.Cancel(); + await cts.CancelAsync(); await TestTimeout.TimeoutAfter(appTask, TimeSpan.FromSeconds(10)); } From 8712ee7ff61096875e8d6b032ad927896f2a3063 Mon Sep 17 00:00:00 2001 From: Sebastian Krysmanski Date: Mon, 4 Mar 2024 17:39:04 +0100 Subject: [PATCH 4/4] Update CI workflow to .NET 8 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5265166..34594cef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,7 +36,7 @@ permissions: contents: read env: - DOTNET_VERSION: '7.0' + DOTNET_VERSION: '8.0' # NOTE: Jobs run in parallel by default. # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow