Skip to content

Commit

Permalink
V15: Update to dotnet 9 (#16625)
Browse files Browse the repository at this point in the history
* Update to dotnet 9 and update nuget packages

* Update umbraco code version

* Update Directory.Build.props

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Include preview version in pipeline

* update template projects

* update global json with specific version

* Update version.json to v15

* Rename TrimStart and TrimEnd to string specific

* Rename to Exact

* Update global.json

Co-authored-by: Ronald Barendse <ronald@barend.se>

* Remove includePreviewVersion

* Rename to trim exact

---------

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
Co-authored-by: Ronald Barendse <ronald@barend.se>
  • Loading branch information
3 people authored Jul 1, 2024
1 parent 01909ca commit a5b9fd1
Show file tree
Hide file tree
Showing 43 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Company>Umbraco HQ</Company>
<Authors>Umbraco</Authors>
<Copyright>Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy'))</Copyright>
Expand Down
46 changes: 23 additions & 23 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@
<ItemGroup>
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.1.0" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.2.0" />
<GlobalPackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
</ItemGroup>
<!-- Microsoft packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.5" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.5" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.5" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.5" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.5" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.5" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="8.0.5" />
<PackageVersion Include="Microsoft.Extensions.Identity.Stores" Version="8.0.5" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.0-preview.5.24306.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0-preview.5.24306.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.5.24306.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.Extensions.Identity.Stores" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.0-preview.5.24306.7" />
</ItemGroup>
<!-- Umbraco packages -->
<ItemGroup>
Expand Down Expand Up @@ -83,7 +83,7 @@
<!-- Dazinator.Extensions.FileProviders brings in a vulnerable version of System.Net.Http -->
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<!-- Examine brings in a vulnerable version of System.Security.Cryptography.Xml -->
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="9.0.0-preview.5.24306.7" />
<!-- Both Dazinator.Extensions.FileProviders and MiniProfiler.AspNetCore.Mvc bring in a vulnerable version of System.Text.RegularExpressions -->
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ stages:
- ${{ if eq(parameters.isNightly, true) }}:
pwsh: npm run test --ignore-certificate-errors
${{ else }}:
pwsh: npm run smokeTest --ignore-certificate-errors
pwsh: npm run smokeTest --ignore-certificate-errors
displayName: Run Playwright tests
continueOnError: true
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100-preview.5.24307.3",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion src/Umbraco.Cms.Api.Common/OpenApi/SchemaIdHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private string SanitizedTypeName(Type t) => t.Name
// first grab the "non-generic" part of any generic type name (i.e. "PagedViewModel`1" becomes "PagedViewModel")
.Split('`').First()
// then remove the "ViewModel" postfix from type names
.TrimEnd("ViewModel");
.TrimEndExact("ViewModel");

private string HandleGenerics(string name, Type type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private IPublishedMediaCache GetRequiredPublishedMediaCache()
return null;
}

var childrenOf = fetch.TrimStart(childrenOfParameter);
var childrenOf = fetch.TrimStartExact(childrenOfParameter);
if (childrenOf.IsNullOrWhiteSpace())
{
// this mirrors the current behavior of the Content Delivery API :-)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public RequestRedirectService(
}

// important: redirect URLs are always tracked without trailing slashes
IRedirectUrl? redirectUrl = _redirectUrlService.GetMostRecentRedirectUrl(requestedPath.TrimEnd("/"), culture);
IRedirectUrl? redirectUrl = _redirectUrlService.GetMostRecentRedirectUrl(requestedPath.TrimEndExact("/"), culture);
IPublishedContent? content = redirectUrl != null
? _apiPublishedContentCache.GetById(redirectUrl.ContentKey)
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Task<PagedViewModel<IndexResponseModel>> All(
{
IndexResponseModel[] indexes = _examineManager.Indexes
.Select(_indexPresentationFactory.Create)
.OrderBy(indexModel => indexModel.Name.TrimEnd("Indexer")).ToArray();
.OrderBy(indexModel => indexModel.Name.TrimEndExact("Indexer")).ToArray();

var viewModel = new PagedViewModel<IndexResponseModel> { Items = indexes.Skip(skip).Take(take), Total = indexes.Length };
return Task.FromResult(viewModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<ActionResult<PagedViewModel<SearcherResponse>>> All(
var searchers = new List<SearcherResponse>(
_examineManager.RegisteredSearchers.Select(searcher => new SearcherResponse { Name = searcher.Name })
.OrderBy(x =>
x.Name.TrimEnd("Searcher"))); // order by name , but strip the "Searcher" from the end if it exists
x.Name.TrimEndExact("Searcher"))); // order by name , but strip the "Searcher" from the end if it exists
var viewModel = new PagedViewModel<SearcherResponse>
{
Items = searchers.Skip(skip).Take(take),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<title>Website is Under Maintainance</title>

<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStart("~") , "website", "/nonodes.css")" />
<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStartExact("~") , "website", "/nonodes.css")" />
<style type="text/css">
body {
color:initial;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<title>Umbraco: No Published Content</title>

<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStart("~") , "website", "/nonodes.css")" />
<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStartExact("~") , "website", "/nonodes.css")" />
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<title>Page Not Found</title>

<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStart("~") , "website", "/nonodes.css")" />
<link rel="stylesheet" href="@WebPath.Combine(backOfficePath.TrimStartExact("~") , "website", "/nonodes.css")" />
<style type="text/css">
body {
color:initial;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal static string GetModelsDirectory(string root, string config, bool accep

if (config.StartsWith("~/"))
{
var dir = Path.Combine(root, config.TrimStart("~/"));
var dir = Path.Combine(root, config.TrimStartExact("~/"));

// sanitize - GetFullPath will take care of any relative
// segments in path, eg '../../foo.tmp' - it may throw a SecurityException
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ApiContentRouteBuilder(

if (_globalSettings.HideTopLevelNodeFromPath == false)
{
contentPath = contentPath.TrimStart(rootPath.EnsureStartsWith("/")).EnsureStartsWith("/");
contentPath = contentPath.TrimStartExact(rootPath.EnsureStartsWith("/")).EnsureStartsWith("/");
}

return new ApiContentRoute(contentPath, new ApiContentStartItem(root.Key, rootPath));
Expand Down
10 changes: 5 additions & 5 deletions src/Umbraco.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ public static bool IsVowel(this char c)
/// <param name="value">The value.</param>
/// <param name="forRemoving">For removing.</param>
/// <returns></returns>
public static string Trim(this string value, string forRemoving)
public static string TrimExact(this string value, string forRemoving)
{
if (string.IsNullOrEmpty(value))
{
return value;
}

return value.TrimEnd(forRemoving).TrimStart(forRemoving);
return value.TrimEndExact(forRemoving).TrimStartExact(forRemoving);
}

public static string EncodeJsString(this string s)
Expand Down Expand Up @@ -343,7 +343,7 @@ public static string EncodeJsString(this string s)
return sb.ToString();
}

public static string TrimEnd(this string value, string forRemoving)
public static string TrimEndExact(this string value, string forRemoving)
{
if (string.IsNullOrEmpty(value))
{
Expand All @@ -363,7 +363,7 @@ public static string TrimEnd(this string value, string forRemoving)
return value;
}

public static string TrimStart(this string value, string forRemoving)
public static string TrimStartExact(this string value, string forRemoving)
{
if (string.IsNullOrEmpty(value))
{
Expand All @@ -390,7 +390,7 @@ public static string EnsureStartsWith(this string input, string toStartWith)
return input;
}

return toStartWith + input.TrimStart(toStartWith);
return toStartWith + input.TrimStartExact(toStartWith);
}

public static string EnsureStartsWith(this string input, char value) =>
Expand Down
12 changes: 6 additions & 6 deletions src/Umbraco.Core/Models/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,19 @@ public override bool IsPropertyDirty(string propertyName)
// Special check here since we want to check if the request is for changed cultures
if (propertyName.StartsWith(ChangeTrackingPrefix.PublishedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.PublishedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.PublishedCulture);
return _currentPublishCultureChanges.addedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.UnpublishedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.UnpublishedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.UnpublishedCulture);
return _currentPublishCultureChanges.removedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.ChangedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.ChangedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.ChangedCulture);
return _currentPublishCultureChanges.updatedCultures?.Contains(culture) ?? false;
}

Expand All @@ -379,19 +379,19 @@ public override bool WasPropertyDirty(string propertyName)
// Special check here since we want to check if the request is for changed cultures
if (propertyName.StartsWith(ChangeTrackingPrefix.PublishedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.PublishedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.PublishedCulture);
return _previousPublishCultureChanges.addedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.UnpublishedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.UnpublishedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.UnpublishedCulture);
return _previousPublishCultureChanges.removedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.ChangedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.ChangedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.ChangedCulture);
return _previousPublishCultureChanges.updatedCultures?.Contains(culture) ?? false;
}

Expand Down
12 changes: 6 additions & 6 deletions src/Umbraco.Core/Models/ContentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,19 +578,19 @@ public override bool IsPropertyDirty(string propertyName)
// Special check here since we want to check if the request is for changed cultures
if (propertyName.StartsWith(ChangeTrackingPrefix.AddedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.AddedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.AddedCulture);
return _currentCultureChanges.addedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.RemovedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.RemovedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.RemovedCulture);
return _currentCultureChanges.removedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.UpdatedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.UpdatedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.UpdatedCulture);
return _currentCultureChanges.updatedCultures?.Contains(culture) ?? false;
}

Expand All @@ -609,19 +609,19 @@ public override bool WasPropertyDirty(string propertyName)
// Special check here since we want to check if the request is for changed cultures
if (propertyName.StartsWith(ChangeTrackingPrefix.AddedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.AddedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.AddedCulture);
return _previousCultureChanges.addedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.RemovedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.RemovedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.RemovedCulture);
return _previousCultureChanges.removedCultures?.Contains(culture) ?? false;
}

if (propertyName.StartsWith(ChangeTrackingPrefix.UpdatedCulture))
{
var culture = propertyName.TrimStart(ChangeTrackingPrefix.UpdatedCulture);
var culture = propertyName.TrimStartExact(ChangeTrackingPrefix.UpdatedCulture);
return _previousCultureChanges.updatedCultures?.Contains(culture) ?? false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public UmbracoRequestPaths(IOptions<GlobalSettings> globalSettings, IHostingEnvi
_appPath = hostingEnvironment.ApplicationVirtualPath;

_backOfficePath = globalSettings.Value.GetBackOfficePath(hostingEnvironment)
.EnsureStartsWith('/').TrimStart(_appPath).EnsureStartsWith('/');
.EnsureStartsWith('/').TrimStartExact(_appPath).EnsureStartsWith('/');

string mvcArea = globalSettings.Value.GetUmbracoMvcArea(hostingEnvironment);

Expand Down Expand Up @@ -73,7 +73,7 @@ public UmbracoRequestPaths(IOptions<GlobalSettings> globalSettings, IHostingEnvi
/// </remarks>
public bool IsBackOfficeRequest(string absPath)
{
string urlPath = absPath.TrimStart(_appPath).EnsureStartsWith('/');
string urlPath = absPath.TrimStartExact(_appPath).EnsureStartsWith('/');

// check if this is in the umbraco back office
if (!urlPath.InvariantStartsWith(_backOfficePath))
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private bool BuildQuery(StringBuilder sb, string query, string? searchFrom, List
for (var index = 0; index < querywords.Length; index++)
{
queryWordsReplaced[index] =
querywords[index].Replace("\\-", " ").Replace("_", " ").Trim(" ");
querywords[index].Replace("\\-", " ").Replace("_", " ").TrimExact(" ");
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public LuceneIndexDiagnostics(
{
var rootDir = _hostingEnvironment.ApplicationPhysicalPath;
d["LuceneIndexFolder"] = fsDir.Directory.ToString().ToLowerInvariant()
.TrimStart(rootDir.ToLowerInvariant()).Replace("\\", " /").EnsureStartsWith('/');
.TrimStartExact(rootDir.ToLowerInvariant()).Replace("\\", " /").EnsureStartsWith('/');
}

if (_indexOptions != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private static void SanitizeAttributes(Dictionary<string, object> attributes)

foreach (KeyValuePair<string, object> dataAttribute in dataAttributes)
{
var actualKey = dataAttribute.Key.TrimStart("data-");
var actualKey = dataAttribute.Key.TrimStartExact("data-");
attributes.TryAdd(actualKey, dataAttribute.Value);

attributes.Remove(dataAttribute.Key);
Expand Down
Loading

0 comments on commit a5b9fd1

Please sign in to comment.