From 07f34563560e1d5809881e5a5a863e42a1dc01f9 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 12 Nov 2024 22:04:17 +0000 Subject: [PATCH] Update to .NET 9 (#566) * Update to .NET 9 preview 1 Update to preview 1 of .NET 9. * Update .NET SDK to 9.0.100-preview.2.24157.14 (#584) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.2.24157.14. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.1.24081.5 to 9.0.0-preview.2.24128.4 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.1.24081.5 to 9.0.0-preview.2.24128.4. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Update .NET SDK to 9.0.100-preview.3.24204.13 (#607) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.3.24204.13. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.2.24128.4 to 9.0.0-preview.3.24172.13 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.2.24128.4 to 9.0.0-preview.3.24172.13. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Update .NET SDK to 9.0.100-preview.4.24267.66 (#648) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.4.24267.66. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.3.24172.13 to 9.0.0-preview.4.24267.6 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.3.24172.13 to 9.0.0-preview.4.24267.6. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Fix build Add compatibility suppression for netstandard2.0. * Fix ambiguous methods Remove span to use params span overloads. --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> Co-authored-by: martincostello * Use C# 13 Set `LangVersion=preview` to use C# 13. * Update .NET SDK to 9.0.100-preview.5.24307.3 (#675) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.5.24307.3. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.4.24267.6 to 9.0.0-preview.5.24306.11 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.4.24267.6 to 9.0.0-preview.5.24306.11. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Update .NET SDK to 9.0.100-preview.6.24328.19 (#691) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.6.24328.19. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.5.24306.11 to 9.0.0-preview.6.24328.4 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.5.24306.11 to 9.0.0-preview.6.24328.4. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Fix build - Set `NuGetAuditMode=direct`. - Move CA1848 suppression to ruleset file. - Suppress IDE0130. --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> Co-authored-by: martincostello * Update .NET SDK to 9.0.100-preview.7.24407.12 (#712) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.7.24407.12. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.6.24328.4 to 9.0.0-preview.7.24406.2 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.6.24328.4 to 9.0.0-preview.7.24406.2. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Revert to LangVersion latest Revert back to using the latest version of C# instead of preview. * Update .NET SDK (#732) Update .NET SDK to version 9.0.100-rc.1.24452.12. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Update NuGet package Update NuGet package for RC1. * Update .NET SDK to 9.0.100-rc.2.24474.11 (#755) * Update .NET SDK Update .NET SDK to version 9.0.100-rc.2.24474.11. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-rc.1.24452.1 to 9.0.0-rc.2.24474.3 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-rc.1.24452.1 to 9.0.0-rc.2.24474.3. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Update .NET SDK to 9.0.100 (#777) * Update .NET SDK Update .NET SDK to version 9.0.100. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.0-rc.2.24474.3 to 9.0.0 Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-rc.2.24474.3 to 9.0.0. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> * Set executable bit Fix executable bit being unset. --------- Signed-off-by: costellobot <102549341+costellobot@users.noreply.github.com> Co-authored-by: costellobot <102549341+costellobot@users.noreply.github.com> --- .vsconfig | 2 +- Directory.Packages.props | 2 +- README.md | 2 +- build.ps1 | 4 ---- global.json | 2 +- src/Logging.XUnit/CompatibilitySuppressions.xml | 11 +++++++++++ .../MartinCostello.Logging.XUnit.Tests.csproj | 2 +- tests/Logging.XUnit.Tests/XUnitLoggerTests.cs | 16 +++++++++++----- tests/SampleApp/SampleApp.csproj | 2 +- 9 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 src/Logging.XUnit/CompatibilitySuppressions.xml diff --git a/.vsconfig b/.vsconfig index a991ed17..8114a325 100644 --- a/.vsconfig +++ b/.vsconfig @@ -3,7 +3,7 @@ "components": [ "Microsoft.VisualStudio.Component.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor", - "Microsoft.NetCore.Component.Runtime.8.0", + "Microsoft.NetCore.Component.Runtime.9.0", "Microsoft.NetCore.Component.SDK", "Microsoft.VisualStudio.Component.Roslyn.Compiler", "Microsoft.VisualStudio.Component.Roslyn.LanguageServices" diff --git a/Directory.Packages.props b/Directory.Packages.props index 08c0b492..3f190a09 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/README.md b/README.md index e799c202..45654e04 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ This project is licensed under the [Apache 2.0](http://www.apache.org/licenses/L ## Building and Testing -Compiling the library yourself requires Git and the [.NET SDK](https://www.microsoft.com/net/download/core "Download the .NET SDK") to be installed (version `8.0.100` or later). +Compiling the library yourself requires Git and the [.NET SDK](https://www.microsoft.com/net/download/core "Download the .NET SDK") to be installed (version `9.0.100` or later). To build and test the library locally from a terminal/command-line, run one of the following set of commands: diff --git a/build.ps1 b/build.ps1 index 1b75cfca..ffb7bca0 100755 --- a/build.ps1 +++ b/build.ps1 @@ -7,10 +7,6 @@ param( [Parameter(Mandatory = $false)][switch] $SkipTests ) -if ($null -eq $env:MSBUILDTERMINALLOGGER) { - $env:MSBUILDTERMINALLOGGER = "auto" -} - $ErrorActionPreference = "Stop" $InformationPreference = "Continue" $ProgressPreference = "SilentlyContinue" diff --git a/global.json b/global.json index b962d273..217f7c9f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.404", + "version": "9.0.100", "allowPrerelease": false, "rollForward": "latestMajor" } diff --git a/src/Logging.XUnit/CompatibilitySuppressions.xml b/src/Logging.XUnit/CompatibilitySuppressions.xml new file mode 100644 index 00000000..247ae464 --- /dev/null +++ b/src/Logging.XUnit/CompatibilitySuppressions.xml @@ -0,0 +1,11 @@ + + + + + CP0021 + M:MartinCostello.Logging.XUnit.XUnitLogger.BeginScope``1(``0)``0:notnull + lib/netstandard2.0/MartinCostello.Logging.XUnit.dll + lib/netstandard2.0/MartinCostello.Logging.XUnit.dll + true + + \ No newline at end of file diff --git a/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj b/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj index f3aabe15..9d7cfe66 100644 --- a/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj +++ b/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj @@ -7,7 +7,7 @@ true MartinCostello.Logging.XUnit $(Description) - net8.0 + net9.0 diff --git a/tests/Logging.XUnit.Tests/XUnitLoggerTests.cs b/tests/Logging.XUnit.Tests/XUnitLoggerTests.cs index dab28a5c..1e179d5a 100644 --- a/tests/Logging.XUnit.Tests/XUnitLoggerTests.cs +++ b/tests/Logging.XUnit.Tests/XUnitLoggerTests.cs @@ -287,7 +287,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Only_Exception() string expected = string.Join( Environment.NewLine, - ["[2018-08-19 16:12:16Z] info: MyName[2]", "System.InvalidOperationException: Invalid"]); + "[2018-08-19 16:12:16Z] info: MyName[2]", + "System.InvalidOperationException: Invalid"); // Act logger.Log(LogLevel.Information, new EventId(2), "state", exception, FormatterNull); @@ -317,7 +318,9 @@ public static void XUnitLogger_Log_Logs_Message_If_Message_And_Exception() string expected = string.Join( Environment.NewLine, - ["[2018-08-19 16:12:16Z] warn: MyName[3]", " Message|False|True", "System.InvalidOperationException: Invalid"]); + "[2018-08-19 16:12:16Z] warn: MyName[3]", + " Message|False|True", + "System.InvalidOperationException: Invalid"); // Act logger.Log(LogLevel.Warning, new EventId(3), null, exception, Formatter); @@ -345,7 +348,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Message_And_No_Exception() string expected = string.Join( Environment.NewLine, - ["[2018-08-19 16:12:16Z] fail: MyName[4]", " Message|False|False"]); + "[2018-08-19 16:12:16Z] fail: MyName[4]", + " Message|False|False"); // Act logger.Log(LogLevel.Error, new EventId(4), null, null, Formatter); @@ -379,7 +383,8 @@ public static void XUnitLogger_Log_Logs_Messages(LogLevel logLevel, string short string expected = string.Join( Environment.NewLine, - [$"[2018-08-19 16:12:16Z] {shortLevel}: Your Name[85]", " Message|True|False"]); + $"[2018-08-19 16:12:16Z] {shortLevel}: Your Name[85]", + " Message|True|False"); // Act logger.Log(logLevel, new EventId(85), "Martin", null, Formatter); @@ -429,7 +434,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Scopes_Included_But_There_Are string expected = string.Join( Environment.NewLine, - ["[2018-08-19 16:12:16Z] info: MyName[0]", " Message|False|False"]); + "[2018-08-19 16:12:16Z] info: MyName[0]", + " Message|False|False"); // Act logger.Log(LogLevel.Information, 0, null, null, Formatter); diff --git a/tests/SampleApp/SampleApp.csproj b/tests/SampleApp/SampleApp.csproj index fe4c341b..d1406cd9 100644 --- a/tests/SampleApp/SampleApp.csproj +++ b/tests/SampleApp/SampleApp.csproj @@ -2,6 +2,6 @@ false $(NoWarn);CA1801;CA1822;CA1861;SA1600;SA1601 - net8.0 + net9.0