diff --git a/Directory.Packages.props b/Directory.Packages.props index 976f971f46..fe1b24d22d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,6 @@ - @@ -56,7 +55,6 @@ - diff --git a/src/Umbraco.Core/Cache/Refreshers/Implement/MemberCacheRefresher.cs b/src/Umbraco.Core/Cache/Refreshers/Implement/MemberCacheRefresher.cs index ac9dac5a09..18809a6bbe 100644 --- a/src/Umbraco.Core/Cache/Refreshers/Implement/MemberCacheRefresher.cs +++ b/src/Umbraco.Core/Cache/Refreshers/Implement/MemberCacheRefresher.cs @@ -1,5 +1,3 @@ -// using Newtonsoft.Json; - using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Notifications; diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Examine.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Examine.cs index 4cd7df61a0..91413064f5 100644 --- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Examine.cs +++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Examine.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Umbraco.Cms.Core.DeliveryApi; using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Models; @@ -41,7 +42,9 @@ public static partial class UmbracoBuilderExtensions factory.GetRequiredService(), factory.GetRequiredService(), true, - factory.GetRequiredService())); + factory.GetRequiredService(), + factory.GetRequiredService(), + factory.GetRequiredService>())); builder.Services.AddUnique(factory => new ContentValueSetBuilder( factory.GetRequiredService(), @@ -50,7 +53,9 @@ public static partial class UmbracoBuilderExtensions factory.GetRequiredService(), factory.GetRequiredService(), false, - factory.GetRequiredService())); + factory.GetRequiredService(), + factory.GetRequiredService(), + factory.GetRequiredService>())); builder.Services.AddUnique, MediaValueSetBuilder>(); builder.Services.AddUnique, MemberValueSetBuilder>(); builder.Services.AddUnique(); diff --git a/src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs index 860c6199f7..ff1df21bd1 100644 --- a/src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs +++ b/src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs @@ -1,14 +1,11 @@ using Examine; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.Membership; using Umbraco.Cms.Core.PropertyEditors; using Umbraco.Cms.Core.Scoping; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; -using Umbraco.Cms.Web.Common.DependencyInjection; using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Examine; @@ -52,72 +49,6 @@ public class ContentValueSetBuilder : BaseValueSetBuilder, IContentVal _logger = logger; } - [Obsolete("Use non-obsolete ctor, scheduled for removal in v14")] - public ContentValueSetBuilder( - PropertyEditorCollection propertyEditors, - UrlSegmentProviderCollection urlSegmentProviders, - IUserService userService, - IShortStringHelper shortStringHelper, - ICoreScopeProvider scopeProvider, - bool publishedValuesOnly, - ILocalizationService localizationService, - IContentTypeService contentTypeService) - : this( - propertyEditors, - urlSegmentProviders, - userService, - shortStringHelper, - scopeProvider, - publishedValuesOnly, - localizationService, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService>()) - { - } - - [Obsolete("Use non-obsolete ctor, scheduled for removal in v14")] - public ContentValueSetBuilder( - PropertyEditorCollection propertyEditors, - UrlSegmentProviderCollection urlSegmentProviders, - IUserService userService, - IShortStringHelper shortStringHelper, - IScopeProvider scopeProvider, - bool publishedValuesOnly, - ILocalizationService localizationService) - : this( - propertyEditors, - urlSegmentProviders, - userService, - shortStringHelper, - scopeProvider, - publishedValuesOnly, - localizationService, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService>()) - { - } - - [Obsolete("Use non-obsolete ctor, scheduled for removal in v14")] - public ContentValueSetBuilder( - PropertyEditorCollection propertyEditors, - UrlSegmentProviderCollection urlSegmentProviders, - IUserService userService, - IShortStringHelper shortStringHelper, - IScopeProvider scopeProvider, - bool publishedValuesOnly) - : this( - propertyEditors, - urlSegmentProviders, - userService, - shortStringHelper, - scopeProvider, - publishedValuesOnly, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService>()) - { - } - /// public override IEnumerable GetValueSets(params IContent[] content) { @@ -222,7 +153,7 @@ public class ContentValueSetBuilder : BaseValueSetBuilder, IContentVal { AddPropertyValue(property, null, null, values, availableCultures, contentTypeDictionary); } - catch (JsonSerializationException ex) + catch (Exception ex) { _logger.LogError(ex, "Failed to add property '{PropertyAlias}' to index for content {ContentId}", property.Alias, c.Id); throw; @@ -236,7 +167,7 @@ public class ContentValueSetBuilder : BaseValueSetBuilder, IContentVal { AddPropertyValue(property, culture.ToLowerInvariant(), null, values, availableCultures, contentTypeDictionary); } - catch (JsonSerializationException ex) + catch (Exception ex) { _logger.LogError( ex, diff --git a/src/Umbraco.Infrastructure/Extensions/ObjectJsonExtensions.cs b/src/Umbraco.Infrastructure/Extensions/ObjectJsonExtensions.cs index 6a34ae73f0..840e55c77b 100644 --- a/src/Umbraco.Infrastructure/Extensions/ObjectJsonExtensions.cs +++ b/src/Umbraco.Infrastructure/Extensions/ObjectJsonExtensions.cs @@ -1,6 +1,6 @@ using System.Collections.Concurrent; using System.Reflection; -using Newtonsoft.Json; +using System.Text.Json.Serialization; using Umbraco.Cms.Core; namespace Umbraco.Extensions; @@ -27,8 +27,8 @@ public static class ObjectJsonExtensions string DefaultNamer(PropertyInfo property) { - JsonPropertyAttribute? jsonProperty = property.GetCustomAttribute(); - return jsonProperty?.PropertyName ?? property.Name; + JsonPropertyNameAttribute? jsonProperty = property.GetCustomAttribute(); + return jsonProperty?.Name ?? property.Name; } Type t = obj.GetType(); diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/LogMessage.cs b/src/Umbraco.Infrastructure/Logging/Viewer/LogMessage.cs index 42ad881ea3..ee0259d9d9 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/LogMessage.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/LogMessage.cs @@ -1,5 +1,3 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using Serilog.Events; // ReSharper disable UnusedAutoPropertyAccessor.Global @@ -16,7 +14,6 @@ public class LogMessage /// /// The level of the event. /// - [JsonConverter(typeof(StringEnumConverter))] public LogEventLevel Level { get; set; } /// diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SavedLogSearch.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SavedLogSearch.cs index 5393bcd54d..6c43aafd6a 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/SavedLogSearch.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/SavedLogSearch.cs @@ -1,12 +1,8 @@ -using Newtonsoft.Json; - namespace Umbraco.Cms.Core.Logging.Viewer; public class SavedLogSearch { - [JsonProperty("name")] public required string Name { get; set; } - [JsonProperty("query")] public required string Query { get; set; } } diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs index 73d88ac8a8..3cf2768259 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.Logging; -using Newtonsoft.Json; using Serilog.Events; using Serilog.Formatting.Compact.Reader; using ILogger = Serilog.ILogger; @@ -121,7 +120,7 @@ internal class SerilogJsonLogViewer : SerilogLogViewerSourceBase { return reader.TryRead(out evt); } - catch (JsonReaderException ex) + catch (Exception ex) { // As we are reading/streaming one line at a time in the JSON file // Thus we can not report the line number, as it will always be 1 diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ComplexPropertyEditorContentNotificationHandler.cs b/src/Umbraco.Infrastructure/PropertyEditors/ComplexPropertyEditorContentNotificationHandler.cs index ce867d29e4..208b2a1e70 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ComplexPropertyEditorContentNotificationHandler.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ComplexPropertyEditorContentNotificationHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) Umbraco. // See LICENSE for more details. -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Notifications; @@ -55,17 +53,13 @@ public abstract class ComplexPropertyEditorContentNotificationHandler : foreach (IPropertyValue cultureVal in propVals) { // Remove keys from published value & any nested properties - var publishedValue = cultureVal.PublishedValue is JToken jsonPublishedValue - ? jsonPublishedValue.ToString(Formatting.None) - : cultureVal.PublishedValue?.ToString(); + var publishedValue = cultureVal.PublishedValue?.ToString(); var updatedPublishedVal = FormatPropertyValue(publishedValue!, onlyMissingKeys).NullOrWhiteSpaceAsNull(); cultureVal.PublishedValue = updatedPublishedVal; // Remove keys from edited/draft value & any nested properties - var editedValue = cultureVal.EditedValue is JToken jsonEditedValue - ? jsonEditedValue.ToString(Formatting.None) - : cultureVal.EditedValue?.ToString(); + var editedValue = cultureVal.EditedValue?.ToString(); var updatedEditedVal = FormatPropertyValue(editedValue!, onlyMissingKeys).NullOrWhiteSpaceAsNull(); cultureVal.EditedValue = updatedEditedVal; } diff --git a/src/Umbraco.Infrastructure/Services/CacheInstructionService.cs b/src/Umbraco.Infrastructure/Services/CacheInstructionService.cs index 2458705309..b708f36f14 100644 --- a/src/Umbraco.Infrastructure/Services/CacheInstructionService.cs +++ b/src/Umbraco.Infrastructure/Services/CacheInstructionService.cs @@ -1,7 +1,7 @@ +using System.Text.Json; +using System.Text.Json.Serialization; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Umbraco.Cms.Core.Cache; using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Events; @@ -189,11 +189,10 @@ namespace Umbraco.Cms => new( 0, DateTime.UtcNow, - JsonConvert.SerializeObject(instructions, new JsonSerializerSettings() + JsonSerializer.Serialize(instructions, new JsonSerializerOptions { - Formatting = Formatting.None, - DefaultValueHandling = DefaultValueHandling.Ignore, - NullValueHandling = NullValueHandling.Ignore, + WriteIndented = false, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault, }), localIdentity, instructions.Sum(x => x.JsonIdCount)); @@ -252,13 +251,13 @@ namespace Umbraco.Cms } // Deserialize remote instructions & skip if it fails. - if (!TryDeserializeInstructions(instruction, out JArray? jsonInstructions)) + if (TryDeserializeInstructions(instruction, out JsonDocument? jsonInstructions) is false && jsonInstructions is null) { lastId = instruction.Id; // skip continue; } - List instructionBatch = GetAllInstructions(jsonInstructions); + List instructionBatch = GetAllInstructions(jsonInstructions?.RootElement); // Process as per-normal. var success = ProcessDatabaseInstructions(cacheRefreshers, instructionBatch, instruction, processed, cancellationToken, ref lastId); @@ -280,7 +279,7 @@ namespace Umbraco.Cms /// /// Attempts to deserialize the instructions to a JArray. /// - private bool TryDeserializeInstructions(CacheInstruction instruction, out JArray? jsonInstructions) + private bool TryDeserializeInstructions(CacheInstruction instruction, out JsonDocument? jsonInstructions) { if (instruction.Instructions is null) { @@ -291,10 +290,10 @@ namespace Umbraco.Cms try { - jsonInstructions = JsonConvert.DeserializeObject(instruction.Instructions); + jsonInstructions = JsonDocument.Parse(instruction.Instructions); return true; } - catch (JsonException ex) + catch (System.Text.Json.JsonException ex) { _logger.LogError(ex, "Failed to deserialize instructions ({DtoId}: '{DtoInstructions}').", instruction.Id, instruction.Instructions); jsonInstructions = null; @@ -305,7 +304,7 @@ namespace Umbraco.Cms /// /// Parses out the individual instructions to be processed. /// - private static List GetAllInstructions(IEnumerable? jsonInstructions) + private static List GetAllInstructions(JsonElement? jsonInstructions) { var result = new List(); if (jsonInstructions is null) @@ -313,13 +312,13 @@ namespace Umbraco.Cms return result; } - foreach (JToken jsonItem in jsonInstructions) + foreach (JsonElement jsonItem in jsonInstructions.Value.EnumerateArray()) { // Could be a JObject in which case we can convert to a RefreshInstruction. // Otherwise it could be another JArray - in which case we'll iterate that. - if (jsonItem is JObject jsonObj) + if (jsonItem.ValueKind is JsonValueKind.Object) { - RefreshInstruction? instruction = jsonObj.ToObject(); + RefreshInstruction? instruction = jsonItem.Deserialize(); if (instruction is not null) { result.Add(instruction); @@ -327,8 +326,7 @@ namespace Umbraco.Cms } else { - var jsonInnerArray = (JArray)jsonItem; - result.AddRange(GetAllInstructions(jsonInnerArray)); // recurse + result.AddRange(GetAllInstructions(jsonItem)); // recurse } } @@ -465,7 +463,7 @@ namespace Umbraco.Cms return; } - var ids = JsonConvert.DeserializeObject(jsonIds); + var ids = JsonSerializer.Deserialize(jsonIds); if (ids is not null) { foreach (var id in ids) diff --git a/src/Umbraco.Infrastructure/Services/Implement/LogViewerRepository.cs b/src/Umbraco.Infrastructure/Services/Implement/LogViewerRepository.cs index 853926141e..e1aac6486a 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/LogViewerRepository.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/LogViewerRepository.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.Logging; -using Newtonsoft.Json; using Serilog; using Serilog.Events; using Serilog.Formatting.Compact.Reader; @@ -172,7 +171,7 @@ public class LogViewerRepository : ILogViewerRepository { return reader.TryRead(out evt); } - catch (JsonReaderException ex) + catch (Exception ex) { // As we are reading/streaming one line at a time in the JSON file // Thus we can not report the line number, as it will always be 1 diff --git a/src/Umbraco.Infrastructure/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Infrastructure/Sync/DatabaseServerMessenger.cs index 84b7f82bbe..734f6ff6d4 100644 --- a/src/Umbraco.Infrastructure/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Infrastructure/Sync/DatabaseServerMessenger.cs @@ -54,7 +54,7 @@ public abstract class DatabaseServerMessenger : ServerMessengerBase, IDisposable IJsonSerializer jsonSerializer, LastSyncedFileManager lastSyncedFileManager, IOptionsMonitor globalSettings) - : base(distributedEnabled) + : base(distributedEnabled, jsonSerializer) { _cancellationToken = _cancellationTokenSource.Token; _mainDom = mainDom; diff --git a/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs b/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs index 22b25333a7..1e44a8f5bb 100644 --- a/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs +++ b/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs @@ -1,7 +1,9 @@ +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Cache; +using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.Serialization; using Umbraco.Cms.Core.Sync; namespace Umbraco.Cms.Infrastructure.Sync; @@ -11,12 +13,26 @@ namespace Umbraco.Cms.Infrastructure.Sync; /// public abstract class ServerMessengerBase : IServerMessenger { + private readonly IJsonSerializer _jsonSerializer; + /// /// Initializes a new instance of the class. /// /// If set to true makes distributed calls when messaging a cache refresher. + /// + public ServerMessengerBase(bool distributedEnabled, IJsonSerializer jsonSerializer) + { + DistributedEnabled = distributedEnabled; + _jsonSerializer = jsonSerializer; + } + + [Obsolete("Use constructor that takes IJsonSerializer, scheduled for removal in V16")] protected ServerMessengerBase(bool distributedEnabled) - => DistributedEnabled = distributedEnabled; + : this( + distributedEnabled, + StaticServiceProvider.Instance.GetRequiredService()) + { + } /// /// Gets or sets a value indicating whether distributed calls are made when messaging a cache refresher. @@ -377,7 +393,7 @@ public abstract class ServerMessengerBase : IServerMessenger } // deliver remote - var json = JsonConvert.SerializeObject(payload); + var json = _jsonSerializer.Serialize(payload); DeliverRemote(refresher, MessageType.RefreshByJson, null, json); } diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index f1f51237a7..a3b64b1cc5 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -23,7 +23,6 @@ - diff --git a/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs b/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs index ee89a7e807..a4320b9391 100644 --- a/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs @@ -1,5 +1,4 @@ using System.Globalization; -using Newtonsoft.Json.Linq; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Media; using Umbraco.Cms.Core.Models; @@ -535,11 +534,6 @@ public static class ImageCropperTemplateCoreExtensions var mediaCrops = cropperValue as ImageCropperValue; - if (mediaCrops == null && cropperValue is JObject jobj) - { - mediaCrops = jobj.ToObject(); - } - if (mediaCrops == null && cropperValue is string imageCropperValue && string.IsNullOrEmpty(imageCropperValue) == false && imageCropperValue.DetectIsJson()) { diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index 3b32a9dbab..4fa0721a68 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -14,7 +14,6 @@ - diff --git a/tests/Directory.Packages.props b/tests/Directory.Packages.props index 586469c2c8..0fd40d25b4 100644 --- a/tests/Directory.Packages.props +++ b/tests/Directory.Packages.props @@ -21,5 +21,6 @@ + - \ No newline at end of file + diff --git a/tests/Umbraco.Tests.Benchmarks/JsonSerializerSettingsBenchmarks.cs b/tests/Umbraco.Tests.Benchmarks/JsonSerializerSettingsBenchmarks.cs deleted file mode 100644 index 390bb31b61..0000000000 --- a/tests/Umbraco.Tests.Benchmarks/JsonSerializerSettingsBenchmarks.cs +++ /dev/null @@ -1,60 +0,0 @@ -using BenchmarkDotNet.Attributes; -using Newtonsoft.Json; -using Umbraco.Tests.Benchmarks.Config; - -namespace Umbraco.Tests.Benchmarks; - -[QuickRunConfig] -[MemoryDiagnoser] -public class JsonSerializerSettingsBenchmarks -{ - [Benchmark] - public void SerializerSettingsInstantiation() - { - var instances = 1000; - for (var i = 0; i < instances; i++) - { - new JsonSerializerSettings(); - } - } - - [Benchmark(Baseline = true)] - public void SerializerSettingsSingleInstantiation() => new JsonSerializerSettings(); - - // // * Summary * - - // BenchmarkDotNet=v0.11.3, OS=Windows 10.0.18362 - //Intel Core i5-8265U CPU 1.60GHz(Kaby Lake R), 1 CPU, 8 logical and 4 physical cores - // [Host] : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4250.0 - // Job-JIATTD : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4250.0 - - //IterationCount=3 IterationTime=100.0000 ms LaunchCount = 1 - //WarmupCount=3 - - // Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | - //-------------------------------------- |-------------:|-------------:|------------:|-------:|--------:|------------:|------------:|------------:|--------------------:| - // SerializerSettingsInstantiation | 29,120.48 ns | 5,532.424 ns | 303.2508 ns | 997.84 | 23.66 | 73.8122 | - | - | 232346 B | - // SerializerSettingsSingleInstantiation | 29.19 ns | 8.089 ns | 0.4434 ns | 1.00 | 0.00 | 0.0738 | - | - | 232 B | - - //// * Warnings * - //MinIterationTime - // JsonSerializerSettingsBenchmarks.SerializerSettingsSingleInstantiation: IterationCount= 3, IterationTime= 100.0000 ms, LaunchCount= 1, WarmupCount= 3->MinIterationTime = 96.2493 ms which is very small. It's recommended to increase it. - - //// * Legends * - // Mean : Arithmetic mean of all measurements - // Error : Half of 99.9% confidence interval - // StdDev : Standard deviation of all measurements - // Ratio : Mean of the ratio distribution ([Current]/[Baseline]) - // RatioSD : Standard deviation of the ratio distribution([Current]/[Baseline]) - // Gen 0/1k Op : GC Generation 0 collects per 1k Operations - // Gen 1/1k Op : GC Generation 1 collects per 1k Operations - // Gen 2/1k Op : GC Generation 2 collects per 1k Operations - // Allocated Memory/Op : Allocated memory per single operation(managed only, inclusive, 1KB = 1024B) - // 1 ns : 1 Nanosecond(0.000000001 sec) - - //// * Diagnostic Output - MemoryDiagnoser * - - - // // ***** BenchmarkRunner: End ***** - // Run time: 00:00:04 (4.88 sec), executed benchmarks: 2 -} diff --git a/tests/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj b/tests/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj index bf0dc9ddc1..cd801dc4ce 100644 --- a/tests/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj +++ b/tests/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj @@ -13,6 +13,7 @@ + diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Scoping/ScopedRepositoryTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Scoping/ScopedRepositoryTests.cs index e62e1ebecf..0c09bf14e8 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Scoping/ScopedRepositoryTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Scoping/ScopedRepositoryTests.cs @@ -16,6 +16,7 @@ using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Sync; using Umbraco.Cms.Infrastructure.PublishedCache; using Umbraco.Cms.Infrastructure.Scoping; +using Umbraco.Cms.Infrastructure.Serialization; using Umbraco.Cms.Infrastructure.Sync; using Umbraco.Cms.Tests.Common.Testing; using Umbraco.Cms.Tests.Integration.Testing; @@ -328,7 +329,7 @@ public class ScopedRepositoryTests : UmbracoIntegrationTest public class LocalServerMessenger : ServerMessengerBase { public LocalServerMessenger() - : base(false) + : base(false, new SystemTextJsonSerializer()) { } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEventsTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEventsTests.cs index ad77f68b10..0c843cd5d6 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEventsTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEventsTests.cs @@ -13,6 +13,7 @@ using Umbraco.Cms.Core.Notifications; using Umbraco.Cms.Core.Persistence.Repositories; using Umbraco.Cms.Core.Sync; using Umbraco.Cms.Core.Web; +using Umbraco.Cms.Infrastructure.Serialization; using Umbraco.Cms.Infrastructure.Sync; using Umbraco.Cms.Tests.Common.Attributes; using Umbraco.Cms.Tests.Common.Builders; @@ -2088,7 +2089,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services public class LocalServerMessenger : ServerMessengerBase { public LocalServerMessenger() - : base(false) + : base(false, new SystemTextJsonSerializer()) { } diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/ReflectionUtilitiesTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/ReflectionUtilitiesTests.cs index 342a202a29..7a2efdedac 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/ReflectionUtilitiesTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/ReflectionUtilitiesTests.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using Newtonsoft.Json; +using System.Text.Json.Serialization; using NUnit.Framework; using Umbraco.Cms.Core; using Umbraco.Extensions; @@ -752,7 +752,7 @@ public class ReflectionUtilitiesTests public class Class5 : Class4 { - [JsonProperty("intValue2")] + [JsonPropertyName("intValue2")] public int IntValue2 { get; set; } public string StringValue2 { get; set; }