Skip to content

Commit

Permalink
Merge branch 'hotfix/6.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Apr 10, 2024
2 parents 976bda9 + 3937d56 commit 64100dc
Show file tree
Hide file tree
Showing 19 changed files with 157 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.2.0",
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/docker-tasks.cake
@@ -1,7 +1,7 @@
#l "docker-variables.cake"
#l "lib-octopusdeploy.cake"

#addin "nuget:?package=Cake.Docker&version=1.2.3"
#addin "nuget:?package=Cake.Docker&version=1.3.0"

//-------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions deployment/cake/generic-variables.cake
Expand Up @@ -400,7 +400,7 @@ public class SonarQubeContext : BuildContextBase
public string Url { get; set; }
public string Organization { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Token { get; set; }
public string Project { get; set; }

protected override void ValidateContext()
Expand Down Expand Up @@ -514,7 +514,7 @@ private GeneralContext InitializeGeneralContext(BuildContext buildContext, IBuil
Url = buildContext.BuildServer.GetVariable("SonarUrl", showValue: true),
Organization = buildContext.BuildServer.GetVariable("SonarOrganization", showValue: true),
Username = buildContext.BuildServer.GetVariable("SonarUsername", showValue: false),
Password = buildContext.BuildServer.GetVariable("SonarPassword", showValue: false),
Token = buildContext.BuildServer.GetVariable("SonarToken", showValue: false),
Project = buildContext.BuildServer.GetVariable("SonarProject", data.Solution.Name, showValue: true)
};

Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/github-pages-tasks.cake
@@ -1,6 +1,6 @@
#l "github-pages-variables.cake"

#addin "nuget:?package=Cake.Git&version=3.0.0"
#addin "nuget:?package=Cake.Git&version=4.0.0"

//-------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/issuetrackers-github.cake
@@ -1,4 +1,4 @@
#tool "nuget:?package=gitreleasemanager&version=0.16.0"
#tool "nuget:?package=gitreleasemanager&version=0.17.0"

//-------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions deployment/cake/lib-msbuild.cake
@@ -1,5 +1,5 @@
#addin "nuget:?package=Cake.Issues&version=3.0.0"
#addin "nuget:?package=Cake.Issues.MsBuild&version=3.0.0"
#addin "nuget:?package=Cake.Issues&version=4.1.0"
#addin "nuget:?package=Cake.Issues.MsBuild&version=4.1.0"

#tool "nuget:?package=MSBuild.Extension.Pack&version=1.9.1"

Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/sourcecontrol-github.cake
@@ -1,5 +1,5 @@
#addin "nuget:?package=Cake.GitHub&version=0.1.0"
#addin "nuget:?package=Octokit&version=9.0.0"
#addin "nuget:?package=Octokit&version=10.0.0"

//-------------------------------------------------------------

Expand Down
20 changes: 10 additions & 10 deletions deployment/cake/tasks.cake
Expand Up @@ -24,8 +24,8 @@
#l "tests.cake"
#l "templates-tasks.cake"

#addin "nuget:?package=Cake.FileHelpers&version=6.1.3"
#addin "nuget:?package=Cake.Sonar&version=1.1.32"
#addin "nuget:?package=Cake.FileHelpers&version=7.0.0"
#addin "nuget:?package=Cake.Sonar&version=1.1.33"
#addin "nuget:?package=MagicChunks&version=2.0.0.119"
#addin "nuget:?package=Newtonsoft.Json&version=13.0.3"
Expand All @@ -36,7 +36,7 @@
// It probably means the tool is not correctly installed.
// `dotnet tool install --global dotnet-sonarscanner --ignore-failed-sources`
//#tool "nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.8.0"
#tool "nuget:?package=dotnet-sonarscanner&version=6.0.0"
#tool "nuget:?package=dotnet-sonarscanner&version=6.2.0"

//-------------------------------------------------------------
// BACKWARDS COMPATIBILITY CODE - START
Expand Down Expand Up @@ -397,9 +397,9 @@ Task("Build")
sonarSettings.Login = buildContext.General.SonarQube.Username;
}
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Password))
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Token))
{
sonarSettings.Password = buildContext.General.SonarQube.Password;
sonarSettings.Token = buildContext.General.SonarQube.Token;
}
// see https://cakebuild.net/api/Cake.Sonar/SonarBeginSettings/ for more information on
Expand Down Expand Up @@ -450,25 +450,25 @@ Task("Build")
{
await buildContext.SourceControl.MarkBuildAsPendingAsync("SonarQube");
var sonarEndSettings = new SonarEndSettings
var sonarSettings = new SonarEndSettings
{
// Use core clr version of SonarQube
UseCoreClr = true
};
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Username))
{
sonarEndSettings.Login = buildContext.General.SonarQube.Username;
sonarSettings.Login = buildContext.General.SonarQube.Username;
}
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Password))
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Token))
{
sonarEndSettings.Password = buildContext.General.SonarQube.Password;
sonarSettings.Token = buildContext.General.SonarQube.Token;
}
Information("Ending SonarQube");
SonarEnd(sonarEndSettings);
SonarEnd(sonarSettings);
await buildContext.SourceControl.MarkBuildAsSucceededAsync("SonarQube");
}
Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/tests-nunit.cake
@@ -1,4 +1,4 @@
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.16.3"
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.17.0"

//-------------------------------------------------------------

Expand Down
24 changes: 20 additions & 4 deletions src/Catel.Core/Caching/CacheStorage.cs
Expand Up @@ -249,7 +249,7 @@ public TValue GetFromCacheOrFetch(TKey key, Func<TValue> code, bool @override =
{
ArgumentNullException.ThrowIfNull(code);

return GetFromCacheOrFetch(key, code, ExpirationPolicy.Duration(expiration), @override);
return GetFromCacheOrFetch(key, code, CreateDefaultExpirationPolicy(expiration), @override);
}

/// <summary>
Expand Down Expand Up @@ -319,7 +319,7 @@ public Task<TValue> GetFromCacheOrFetchAsync(TKey key, Func<Task<TValue>> code,
/// <exception cref="ArgumentNullException">If <paramref name="code" /> is <c>null</c>.</exception>
public Task<TValue> GetFromCacheOrFetchAsync(TKey key, Func<Task<TValue>> code, bool @override = false, TimeSpan expiration = default)
{
return GetFromCacheOrFetchAsync(key, code, ExpirationPolicy.Duration(expiration), @override);
return GetFromCacheOrFetchAsync(key, code, CreateDefaultExpirationPolicy(expiration), @override);
}

/// <summary>
Expand All @@ -330,9 +330,9 @@ public Task<TValue> GetFromCacheOrFetchAsync(TKey key, Func<Task<TValue>> code,
/// <param name="override">Indicates if the key exists the value will be overridden.</param>
/// <param name="expiration">The timespan in which the cache item should expire when added.</param>
/// <exception cref="ArgumentNullException">The <paramref name="key" /> is <c>null</c>.</exception>
public void Add(TKey key, TValue @value, bool @override = false, TimeSpan expiration = default(TimeSpan))
public void Add(TKey key, TValue @value, bool @override = false, TimeSpan expiration = default)
{
Add(key, value, ExpirationPolicy.Duration(expiration), @override);
Add(key, value, CreateDefaultExpirationPolicy(expiration), @override);
}

/// <summary>
Expand Down Expand Up @@ -392,6 +392,22 @@ public void Clear()
}
}

/// <summary>
/// Creates the default expiration policy.
/// </summary>
/// <param name="expiration"></param>
/// <returns></returns>
protected virtual ExpirationPolicy? CreateDefaultExpirationPolicy(TimeSpan? expiration)
{
if (expiration is null ||
expiration == default(TimeSpan))
{
return null;
}

return ExpirationPolicy.Duration(expiration.Value);
}

/// <summary>
/// Removes the expired items from the cache.
/// </summary>
Expand Down
Expand Up @@ -351,7 +351,7 @@ public static Array ToArray(this IEnumerable collection, Type elementType)
{
ArgumentNullException.ThrowIfNull(collection);

var internalList = new List<object>(collection is not null ? collection.Cast<object>() : Array.Empty<object>());
var internalList = new List<object>(collection.Cast<object>());
var array = Array.CreateInstance(elementType, internalList.Count);

var index = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Catel.Core/Logging/Log.cs
Expand Up @@ -46,7 +46,7 @@ public Log(string name, Type targetType)
Name = name;
TargetType = targetType;

IsCatelLogging = targetType?.IsCatelType() ?? false;
IsCatelLogging = targetType.IsCatelType();
_shouldIgnoreIfCatelLoggingIsDisabled = new Lazy<bool>(ShouldIgnoreIfCatelLoggingIsDisabled);
}

Expand Down
6 changes: 4 additions & 2 deletions src/Catel.Core/Reflection/Helpers/PropertyHelper.cs
Expand Up @@ -357,17 +357,19 @@ public static TValue GetHiddenPropertyValue<TValue>(object obj, string property,
{
var objectType = obj.GetType();
var stringComparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
if (!ignoreCase)
{
// Use old mechanism to ensure no breaking changes / performance hite
// Use old mechanism to ensure no breaking changes / performance hits
return objectType.GetPropertyEx(property);
}
var allProperties = objectType.GetPropertiesEx();
foreach (var propertyInfo in allProperties)
{
if (string.Equals(propertyInfo.Name, property, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
if (string.Equals(propertyInfo.Name, property, stringComparison))
{
return propertyInfo;
}
Expand Down

0 comments on commit 64100dc

Please sign in to comment.