Merge branch 'v8/8.16' into v8/dev

This commit is contained in:
Sebastiaan Janssen
2021-08-23 15:18:53 +02:00
7 changed files with 66 additions and 26 deletions

View File

@@ -33,7 +33,7 @@
<dependency id="Newtonsoft.Json" version="[12.0.1,12.999999)" />
<dependency id="Semver" version="[2.0.4,2.999999)" />
<dependency id="Serilog" version="[2.10.0,2.999999)" />
<dependency id="Serilog.Enrichers.Process" version="[2.0.1,2.999999)" />
<dependency id="Serilog.Enrichers.Process" version="[2.0.2,2.999999)" />
<dependency id="Serilog.Enrichers.Thread" version="[3.1.0,3.999999)" />
<dependency id="Serilog.Filters.Expressions" version="[2.1.0,2.999999)" />
<dependency id="Serilog.Formatting.Compact" version="[1.1.0,1.999999)" />

View File

@@ -19,4 +19,4 @@ using System.Resources;
// these are FYI and changed automatically
[assembly: AssemblyFileVersion("8.16.0")]
[assembly: AssemblyInformationalVersion("8.16.0-rc")]
[assembly: AssemblyInformationalVersion("8.16.0")]

View File

@@ -79,24 +79,26 @@ namespace Umbraco.Core.Diagnostics
private static bool Write(SafeHandle fileHandle, Option options, bool withException = false)
{
var currentProcess = Process.GetCurrentProcess();
var currentProcessHandle = currentProcess.Handle;
var currentProcessId = (uint)currentProcess.Id;
using (var currentProcess = Process.GetCurrentProcess())
{
var currentProcessHandle = currentProcess.Handle;
var currentProcessId = (uint)currentProcess.Id;
MiniDumpExceptionInformation exp;
MiniDumpExceptionInformation exp;
exp.ThreadId = GetCurrentThreadId();
exp.ClientPointers = false;
exp.ExceptionPointers = IntPtr.Zero;
exp.ThreadId = GetCurrentThreadId();
exp.ClientPointers = false;
exp.ExceptionPointers = IntPtr.Zero;
if (withException)
exp.ExceptionPointers = Marshal.GetExceptionPointers();
if (withException)
exp.ExceptionPointers = Marshal.GetExceptionPointers();
var bRet = exp.ExceptionPointers == IntPtr.Zero
? MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint) options, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)
: MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint) options, ref exp, IntPtr.Zero, IntPtr.Zero);
var bRet = exp.ExceptionPointers == IntPtr.Zero
? MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint)options, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)
: MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint)options, ref exp, IntPtr.Zero, IntPtr.Zero);
return bRet;
return bRet;
}
}
public static bool Dump(Option options = Option.WithFullMemory, bool withException = false)

View File

@@ -901,7 +901,7 @@ namespace Umbraco.Core.Persistence
return -1;
}
var p = new Process
using (var p = new Process
{
StartInfo =
{
@@ -913,13 +913,16 @@ namespace Umbraco.Core.Persistence
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
}
};
p.Start();
output = p.StandardOutput.ReadToEnd();
error = p.StandardError.ReadToEnd();
p.WaitForExit();
})
{
p.Start();
output = p.StandardOutput.ReadToEnd();
error = p.StandardError.ReadToEnd();
p.WaitForExit();
return p.ExitCode;
return p.ExitCode;
}
}
/// <summary>

View File

@@ -535,10 +535,18 @@ namespace Umbraco.Core.Sync
/// </remarks>
protected static readonly string LocalIdentity = NetworkHelper.MachineName // eg DOMAIN\SERVER
+ "/" + HttpRuntime.AppDomainAppId // eg /LM/S3SVC/11/ROOT
+ " [P" + Process.GetCurrentProcess().Id // eg 1234
+ " [P" + GetProcessId() // eg 1234
+ "/D" + AppDomain.CurrentDomain.Id // eg 22
+ "] " + Guid.NewGuid().ToString("N").ToUpper(); // make it truly unique
private static int GetProcessId()
{
using(var p = Process.GetCurrentProcess())
{
return p.Id;
}
}
private string GetDistCacheFilePath(IGlobalSettings globalSettings)
{
var fileName = HttpRuntime.AppDomainAppId.ReplaceNonAlphanumericChars(string.Empty) + "-lastsynced.txt";

View File

@@ -97,7 +97,7 @@
<Version>2.10.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Enrichers.Process">
<Version>2.0.1</Version>
<Version>2.0.2</Version>
</PackageReference>
<PackageReference Include="Serilog.Enrichers.Thread">
<Version>3.1.0</Version>

View File

@@ -5,6 +5,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.PropertyEditors;
@@ -17,6 +18,17 @@ namespace Umbraco.Web.Compose
{
private ComplexPropertyEditorContentEventHandler _handler;
private readonly BlockListEditorDataConverter _converter = new BlockListEditorDataConverter();
private readonly ILogger _logger;
[Obsolete("Use the ctor injecting dependencies.")]
public BlockEditorComponent() : this(Current.Logger)
{
}
public BlockEditorComponent(ILogger logger)
{
_logger = logger;
}
public void Initialize()
{
@@ -116,8 +128,23 @@ namespace Umbraco.Web.Compose
// this gets a little ugly because there could be some other complex editor that contains another block editor
// and since we would have no idea how to parse that, all we can do is try JSON Path to find another block editor
// of our type
var json = JToken.Parse(asString);
if (ProcessJToken(json, createGuid, out var result))
JToken json = null;
try
{
json = JToken.Parse(asString);
}
catch (Exception e)
{
// See issue https://github.com/umbraco/Umbraco-CMS/issues/10879
// We are detecting JSON data by seeing if a string is surrounded by [] or {}
// If people enter text like [PLACEHOLDER] JToken parsing fails, it's safe to ignore though
// Logging this just in case in the future we find values that are not safe to ignore
_logger.Warn<BlockEditorComponent>(
"The property {PropertyAlias} on content type {ContentTypeKey} has a value of: {BlockItemValue} - this was recognized as JSON but could not be parsed",
data.Key, propertyAliasToBlockItemData.Key, asString);
}
if (json != null && ProcessJToken(json, createGuid, out var result))
{
// need to re-save this back to the RawPropertyValues
data.RawPropertyValues[propertyAliasToBlockItemData.Key] = result;