Adds null check and adds back orig ctor for ProfilingLogger

This commit is contained in:
Shannon
2021-07-09 16:37:37 -06:00
parent f7b8a93a35
commit 582fdec213
3 changed files with 18 additions and 4 deletions

View File

@@ -45,7 +45,11 @@ namespace Umbraco.Cms.Core.Composing
return _discovered;
}
IEnumerable<string> additionalTargetAssemblies = _additionalTargetAssemblies.Concat(Constants.Composing.UmbracoCoreAssemblyNames);
IEnumerable<string> additionalTargetAssemblies = Constants.Composing.UmbracoCoreAssemblyNames;
if (_additionalTargetAssemblies != null)
{
additionalTargetAssemblies = additionalTargetAssemblies.Concat(_additionalTargetAssemblies);
}
var finder = new FindAssembliesWithReferencesTo(new[] { _entryPointAssembly }, additionalTargetAssemblies.ToArray(), true, _loggerFactory);
_discovered = finder.Find().ToList();

View File

@@ -18,6 +18,15 @@ namespace Umbraco.Cms.Core.Logging
/// </summary>
public IProfiler Profiler { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ProfilingLogger"/> class.
/// </summary>
public ProfilingLogger(ILogger<ProfilingLogger> logger, IProfiler profiler)
{
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
Profiler = profiler ?? throw new ArgumentNullException(nameof(profiler));
}
/// <summary>
/// Initializes a new instance of the <see cref="ProfilingLogger"/> class.
/// </summary>

View File

@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
@@ -17,7 +17,7 @@ namespace Umbraco.Cms.Core.Templates
private static readonly Regex ResolveUrlPattern = new Regex("(=[\"\']?)(\\W?\\~(?:.(?![\"\']?\\s+(?:\\S+)=|[>\"\']))+.)[\"\']?",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
public HtmlUrlParser(IOptions<ContentSettings> contentSettings, ILogger<HtmlUrlParser> logger ,IProfilingLogger profilingLogger, IIOHelper ioHelper)
public HtmlUrlParser(IOptions<ContentSettings> contentSettings, ILogger<HtmlUrlParser> logger, IProfilingLogger profilingLogger, IIOHelper ioHelper)
{
_contentSettings = contentSettings.Value;
_logger = logger;
@@ -36,7 +36,8 @@ namespace Umbraco.Cms.Core.Templates
/// </remarks>
public string EnsureUrls(string text)
{
if (_contentSettings.ResolveUrlsFromTextString == false) return text;
if (_contentSettings.ResolveUrlsFromTextString == false)
return text;
using (var timer = _profilingLogger.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
{