From 0ad0f86e6e232a6b047035fa665b9f114c679c6d Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 5 Jul 2023 13:13:52 +0200 Subject: [PATCH] Update to dotnet 8 preview 5 (#14492) * Update to .net 8 preview 1 * Update npoco to 5.7.0 * Update pipeline to use .net 8 * Revert "Update npoco to 5.7.0" This reverts commit f7795afa77a41ef2719f639405f73d9c21e4b12e. * Fix tests and updated OpenApi.json * use dotnet 8 in linux container * Updated templates and docker image to dotnet 8 * Bugfix * R Updated docker images to 8.0 preview 1 * linux docker images updated * Force use c# 11, in hope of the acceptance tests will pass * Do not use C# 8 :) * Update to preview 2 * CompatibilitySuppressions * updated templates * Disable package validation * Update to .net8 preview 4 * change EnableStrictModeForCompatibleFrameworksInPackage to false * Package validation * Added CompatibilitySuppressions.xml * Fix up IP networks * Updated to preview 5 * Update docker images * Post merge fixes * Try to update dotnet version of codeql * Delete empty suppression files * Remove dependency * Cleanup --------- Co-authored-by: Elitsa --- .github/workflows/codeql-analysis.yml | 2 +- Directory.Build.props | 10 +++++----- build/azure-pipelines.yml | 2 +- .../Umbraco.Cms.Api.Common.csproj | 1 - ...co.Cms.Persistence.EFCore.SqlServer.csproj | 2 +- ...braco.Cms.Persistence.EFCore.Sqlite.csproj | 2 +- .../Umbraco.Cms.Persistence.EFCore.csproj | 5 +++-- .../Umbraco.Cms.Persistence.Sqlite.csproj | 2 +- .../Umbraco.Cms.StaticAssets.csproj | 8 ++------ src/Umbraco.Core/Umbraco.Core.csproj | 20 +++++++++---------- .../Umbraco.Infrastructure.csproj | 15 +++++++------- .../Umbraco.Web.BackOffice.csproj | 6 +----- .../CompilationOptionsProvider.cs | 13 +----------- .../Mvc/IpAddressUtilities.cs | 16 ++++++++++++++- .../Umbraco.Web.Common.csproj | 8 ++------ src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- .../Umbraco.Web.Website.csproj | 4 ---- .../.template.config/template.json | 10 +++++----- .../UmbracoPackage/UmbracoPackage.csproj | 2 +- .../UmbracoPackageRcl/UmbracoPackage.csproj | 2 +- .../.template.config/template.json | 10 +++++----- .../UmbracoProject/UmbracoProject.csproj | 2 +- .../misc/umbraco-linux.docker | 4 ++-- .../Umbraco.Tests.Benchmarks.csproj | 2 +- .../Umbraco.Tests.Integration.csproj | 4 ++-- .../Umbraco.Core/Components/ComponentTests.cs | 14 +++++++++++++ .../Umbraco.Core/Published/ModelTypeTests.cs | 4 ++-- .../BackOfficeClaimsPrincipalFactoryTests.cs | 4 ++-- .../Umbraco.Tests.UnitTests.csproj | 2 +- 29 files changed, 89 insertions(+), 89 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 86d160aef3..760467ffae 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -15,7 +15,7 @@ permissions: contents: read env: - dotnetVersion: 7.x + dotnetVersion: 8.x dotnetIncludePreviewVersions: true solution: umbraco.sln buildConfiguration: SkipTests diff --git a/Directory.Build.props b/Directory.Build.props index 01cd3b1064..6ca48f7712 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@ - net7.0 - latest + net8.0 + 11.0 Umbraco HQ Umbraco Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy')) @@ -29,9 +29,9 @@ - false - true - 11.0.0 + true + false + 12.0.0-rc1 true true diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 46e78d8b65..4c82646946 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -24,7 +24,7 @@ parameters: variables: nodeVersion: 18.16.0 - dotnetVersion: 7.x + dotnetVersion: 8.x dotnetIncludePreviewVersions: true solution: umbraco.sln buildConfiguration: Release diff --git a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj index edf3fd1f98..4048af3fb4 100644 --- a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj +++ b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj @@ -8,7 +8,6 @@ Umbraco.Cms.Api.Common - diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj index 946c08556f..cc1571540e 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj index f95f1cd1e1..d3274a5005 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj index f8e3851ccd..8d7a835ab1 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj @@ -6,8 +6,9 @@ - - + + + diff --git a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj index 45b6b01052..92d929ce12 100644 --- a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj index 652ab3417e..1cfb2dbd85 100644 --- a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj +++ b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj @@ -6,10 +6,6 @@ / - - - - @@ -25,7 +21,7 @@ - + @@ -37,7 +33,7 @@ - + diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 30d7b8ce7f..6a385aeba6 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -7,18 +7,18 @@ - - - - - - - - - + + + + + + + + + - + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 232c480904..fd36c3c346 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -13,15 +13,14 @@ - - - - - - + + + + + @@ -38,8 +37,8 @@ - - + + diff --git a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj index 00e6c46273..90104b30a4 100644 --- a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj +++ b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj @@ -7,10 +7,6 @@ Umbraco.Cms.Web.BackOffice - - - - @@ -33,4 +29,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CompilationOptionsProvider.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CompilationOptionsProvider.cs index 0dac2084bd..b2c02e54b2 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CompilationOptionsProvider.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CompilationOptionsProvider.cs @@ -193,18 +193,7 @@ internal class CompilationOptionsProvider var parseOptions = new CSharpParseOptions(preprocessorSymbols: (IEnumerable)defines); - if (string.IsNullOrEmpty(dependencyContextOptions.LanguageVersion)) - { - parseOptions = parseOptions.WithLanguageVersion(LanguageVersion.Latest); - } - else if (LanguageVersionFacts.TryParse(dependencyContextOptions.LanguageVersion, out var languageVersion)) - { - parseOptions = parseOptions.WithLanguageVersion(languageVersion); - } - else - { - Debug.Fail($"LanguageVersion {languageVersion} specified in the deps file could not be parsed."); - } + parseOptions = parseOptions.WithLanguageVersion(LanguageVersion.Latest); return parseOptions; } diff --git a/src/Umbraco.Web.Common/Mvc/IpAddressUtilities.cs b/src/Umbraco.Web.Common/Mvc/IpAddressUtilities.cs index 876c1fdd3f..319669571c 100644 --- a/src/Umbraco.Web.Common/Mvc/IpAddressUtilities.cs +++ b/src/Umbraco.Web.Common/Mvc/IpAddressUtilities.cs @@ -7,11 +7,25 @@ public class IpAddressUtilities : IIpAddressUtilities { public bool IsAllowListed(IPAddress clientIpAddress, string allowedIpString) { - if (IPNetwork.TryParse(allowedIpString, out IPNetwork allowedIp) && allowedIp.Contains(clientIpAddress)) + var subnetmaskIndex = allowedIpString.LastIndexOf('/'); + if (subnetmaskIndex >= 0) // It's a network + { + if (IPNetwork.TryParse(allowedIpString, out IPNetwork allowedIp) && allowedIp.Contains(clientIpAddress)) + { + return true; + } + + return false; + } + + // Assume ip address + if (IPAddress.TryParse(allowedIpString, out IPAddress? allowedIpAddress) && allowedIpAddress.Equals(clientIpAddress)) { return true; } return false; + + } } diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index faea7d7e48..dc5fdde359 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -6,16 +6,12 @@ Umbraco.Cms.Web.Common - - - - - - + + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index bc05a391cc..6c67fff677 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -17,7 +17,7 @@ - + all diff --git a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj index 0d4a775a95..f9f3779b47 100644 --- a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj +++ b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj @@ -7,10 +7,6 @@ Umbraco.Cms.Web.Website - - - - diff --git a/templates/UmbracoPackage/.template.config/template.json b/templates/UmbracoPackage/.template.config/template.json index 768a7a4bee..33ec0699b1 100644 --- a/templates/UmbracoPackage/.template.config/template.json +++ b/templates/UmbracoPackage/.template.config/template.json @@ -28,13 +28,13 @@ "datatype": "choice", "choices": [ { - "displayName": ".NET 7.0", - "description": "Target net7.0", - "choice": "net7.0" + "displayName": ".NET 8.0", + "description": "Target net8.0", + "choice": "net8.0" } ], - "defaultValue": "net7.0", - "replaces": "net7.0" + "defaultValue": "net8.0", + "replaces": "net8.0" }, "UmbracoVersion": { "displayName": "Umbraco version", diff --git a/templates/UmbracoPackage/UmbracoPackage.csproj b/templates/UmbracoPackage/UmbracoPackage.csproj index 6da6cf2a79..268611b9ae 100644 --- a/templates/UmbracoPackage/UmbracoPackage.csproj +++ b/templates/UmbracoPackage/UmbracoPackage.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 . UmbracoPackage UmbracoPackage diff --git a/templates/UmbracoPackageRcl/UmbracoPackage.csproj b/templates/UmbracoPackageRcl/UmbracoPackage.csproj index 5c980684ce..1cbdd209e5 100644 --- a/templates/UmbracoPackageRcl/UmbracoPackage.csproj +++ b/templates/UmbracoPackageRcl/UmbracoPackage.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 enable enable true diff --git a/templates/UmbracoProject/.template.config/template.json b/templates/UmbracoProject/.template.config/template.json index d88b23c07d..b17352476e 100644 --- a/templates/UmbracoProject/.template.config/template.json +++ b/templates/UmbracoProject/.template.config/template.json @@ -38,13 +38,13 @@ "datatype": "choice", "choices": [ { - "displayName": ".NET 7.0", - "description": "Target net7.0", - "choice": "net7.0" + "displayName": ".NET 8.0", + "description": "Target net8.0", + "choice": "net8.0" } ], - "defaultValue": "net7.0", - "replaces": "net7.0" + "defaultValue": "net8.0", + "replaces": "net8.0" }, "UmbracoVersion": { "displayName": "Umbraco version", diff --git a/templates/UmbracoProject/UmbracoProject.csproj b/templates/UmbracoProject/UmbracoProject.csproj index d50f95a907..fcd25050f6 100644 --- a/templates/UmbracoProject/UmbracoProject.csproj +++ b/templates/UmbracoProject/UmbracoProject.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 enable enable Umbraco.Cms.Web.UI diff --git a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker index e19483cfa1..d1ca7fb4a4 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker +++ b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker @@ -2,7 +2,7 @@ ## Build ############################################ -FROM mcr.microsoft.com/dotnet/nightly/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/nightly/sdk:8.0.100-preview.6-jammy AS build COPY nuget.config . @@ -22,7 +22,7 @@ RUN dotnet publish --configuration Release --no-build --output /dist ## Run ############################################ -FROM mcr.microsoft.com/dotnet/nightly/aspnet:7.0 AS run +FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0.0-preview.6-jammy AS run WORKDIR /app COPY --from=build dist . diff --git a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index f338b443f3..e24c03c2c3 100644 --- a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index 6ef2c2a70f..49eaf3e04c 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs index a289f03131..ad69df45c0 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs @@ -153,11 +153,20 @@ public class ComponentTests return new ProfilingLogger(Mock.Of>(), Mock.Of()); } + if (type == typeof(ILogger)) + { + return Mock.Of>(); + } + if (type == typeof(ILogger)) { return Mock.Of>(); } + if (type == typeof(IServiceProviderIsService)) + { + return Mock.Of(); + } throw new NotSupportedException(type.FullName); }); }); @@ -315,6 +324,11 @@ public class ComponentTests { return Mock.Of>(); } + + if (type == typeof(IServiceProviderIsService)) + { + return Mock.Of(); + } throw new NotSupportedException(type.FullName); }); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Published/ModelTypeTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Published/ModelTypeTests.cs index eaab03c9b8..c2cbc1e416 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Published/ModelTypeTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Published/ModelTypeTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Umbraco. // See LICENSE for more details. -using System.Collections.Generic; +using System.Collections; using NUnit.Framework; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Tests.Common.Published; @@ -45,7 +45,7 @@ public class ModelTypeTests // Note the inner assembly qualified name Assert.AreEqual( - "System.Collections.Generic.IEnumerable`1[[System.Int32[], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", + $"System.Collections.Generic.IEnumerable`1[[System.Int32[], System.Private.CoreLib, Version={typeof(IEnumerable).Assembly.GetName().Version}, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", typeof(IEnumerable<>).MakeGenericType(type.MakeArrayType()).FullName); } diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs index 1a8cecee6b..afda7c5cbf 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs @@ -64,8 +64,8 @@ public class BackOfficeClaimsPrincipalFactoryTests new BackOfficeClaimsPrincipalFactory(GetMockedUserManager().Object, null)); [Test] - public void Ctor_When_Options_Value_Is_Null_Expect_ArgumentNullException() - => Assert.Throws(() => new BackOfficeClaimsPrincipalFactory( + public void Ctor_When_Options_Value_Is_Null_Expect_ArgumentException() + => Assert.Throws(() => new BackOfficeClaimsPrincipalFactory( GetMockedUserManager().Object, new OptionsWrapper(null))); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj index 5efd49eedf..7d37843ce0 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj @@ -7,8 +7,8 @@ + -