diff --git a/src/Umbraco.Core/Actions/ActionCollection.cs b/src/Umbraco.Core/Actions/ActionCollection.cs
index 841f71b988..1e396952a2 100644
--- a/src/Umbraco.Core/Actions/ActionCollection.cs
+++ b/src/Umbraco.Core/Actions/ActionCollection.cs
@@ -28,7 +28,7 @@ namespace Umbraco.Cms.Core.Actions
///
/// The specified type to get
/// The action
- public T GetAction()
+ public T? GetAction()
where T : IAction => this.OfType().FirstOrDefault();
///
diff --git a/src/Umbraco.Core/Actions/ActionRestore.cs b/src/Umbraco.Core/Actions/ActionRestore.cs
index dc844dd818..164c93e2d5 100644
--- a/src/Umbraco.Core/Actions/ActionRestore.cs
+++ b/src/Umbraco.Core/Actions/ActionRestore.cs
@@ -20,7 +20,7 @@ namespace Umbraco.Cms.Core.Actions
public string Alias => ActionAlias;
///
- public string Category => null;
+ public string? Category => null;
///
public string Icon => "undo";
diff --git a/src/Umbraco.Core/Actions/IAction.cs b/src/Umbraco.Core/Actions/IAction.cs
index 8178b3a557..2d9876afc6 100644
--- a/src/Umbraco.Core/Actions/IAction.cs
+++ b/src/Umbraco.Core/Actions/IAction.cs
@@ -44,6 +44,6 @@ namespace Umbraco.Cms.Core.Actions
///
/// Used in the UI when assigning permissions
///
- string Category { get; }
+ string? Category { get; }
}
}
diff --git a/src/Umbraco.Core/Cache/AppCacheExtensions.cs b/src/Umbraco.Core/Cache/AppCacheExtensions.cs
index 7e6e115fd9..dfb0a7ae72 100644
--- a/src/Umbraco.Core/Cache/AppCacheExtensions.cs
+++ b/src/Umbraco.Core/Cache/AppCacheExtensions.cs
@@ -10,12 +10,12 @@ namespace Umbraco.Extensions
///
public static class AppCacheExtensions
{
- public static T GetCacheItem(this IAppPolicyCache provider,
+ public static T? GetCacheItem(this IAppPolicyCache provider,
string cacheKey,
- Func getCacheItem,
+ Func getCacheItem,
TimeSpan? timeout,
bool isSliding = false,
- string[] dependentFiles = null)
+ string[]? dependentFiles = null)
{
var result = provider.Get(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles);
return result == null ? default(T) : result.TryConvertTo().Result;
@@ -26,7 +26,7 @@ namespace Umbraco.Extensions
Func getCacheItem,
TimeSpan? timeout = null,
bool isSliding = false,
- string[] dependentFiles = null)
+ string[]? dependentFiles = null)
{
provider.Insert(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles);
}
@@ -43,7 +43,7 @@ namespace Umbraco.Extensions
return result.Select(x => x.TryConvertTo().Result);
}
- public static T GetCacheItem(this IAppCache provider, string cacheKey)
+ public static T? GetCacheItem(this IAppCache provider, string cacheKey)
{
var result = provider.Get(cacheKey);
if (result == null)
@@ -53,7 +53,7 @@ namespace Umbraco.Extensions
return result.TryConvertTo().Result;
}
- public static T GetCacheItem(this IAppCache provider, string cacheKey, Func getCacheItem)
+ public static T? GetCacheItem(this IAppCache provider, string cacheKey, Func getCacheItem)
{
var result = provider.Get(cacheKey, () => getCacheItem());
if (result == null)
diff --git a/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs b/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs
index af7c1db228..8239ee4abf 100644
--- a/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs
+++ b/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs
@@ -9,6 +9,7 @@ namespace Umbraco.Cms.Core.Cache
///
/// The type of the dictionary key.
public abstract class AppPolicedCacheDictionary : IDisposable
+ where TKey : notnull
{
private readonly ConcurrentDictionary _caches = new ConcurrentDictionary();
diff --git a/src/Umbraco.Core/Cache/CacheRefresherCollection.cs b/src/Umbraco.Core/Cache/CacheRefresherCollection.cs
index a61dd81368..b9dc7f5984 100644
--- a/src/Umbraco.Core/Cache/CacheRefresherCollection.cs
+++ b/src/Umbraco.Core/Cache/CacheRefresherCollection.cs
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Cache
{
}
- public ICacheRefresher this[Guid id]
+ public ICacheRefresher? this[Guid id]
=> this.FirstOrDefault(x => x.RefresherUniqueId == id);
}
}
diff --git a/src/Umbraco.Core/Cache/DeepCloneAppCache.cs b/src/Umbraco.Core/Cache/DeepCloneAppCache.cs
index be8bf7bdec..60a0d8d7b3 100644
--- a/src/Umbraco.Core/Cache/DeepCloneAppCache.cs
+++ b/src/Umbraco.Core/Cache/DeepCloneAppCache.cs
@@ -35,14 +35,14 @@ namespace Umbraco.Cms.Core.Cache
private IAppPolicyCache InnerCache { get; }
///
- public object Get(string key)
+ public object? Get(string key)
{
var item = InnerCache.Get(key);
return CheckCloneableAndTracksChanges(item);
}
///
- public object Get(string key, Func