diff --git a/Packaging/Package.appxmanifest b/Packaging/Package.appxmanifest
index 2655d91..cd2fbb7 100644
--- a/Packaging/Package.appxmanifest
+++ b/Packaging/Package.appxmanifest
@@ -9,7 +9,7 @@
+ Version="1.0.22.0" />
SystemTrayMenu
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 1e1fd8a..e6dd7f2 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.22.0")]
-[assembly: AssemblyFileVersion("1.0.22.0")]
+[assembly: AssemblyVersion("1.0.22.1")]
+[assembly: AssemblyFileVersion("1.0.22.1")]
diff --git a/Utilities/File/IconReader.cs b/Utilities/File/IconReader.cs
index 6ff009a..f470f25 100644
--- a/Utilities/File/IconReader.cs
+++ b/Utilities/File/IconReader.cs
@@ -25,7 +25,6 @@ namespace SystemTrayMenu.Utilities
private static readonly ConcurrentDictionary DictIconCache = new ConcurrentDictionary();
private static readonly Icon LoadingIcon = Properties.Resources.Loading;
- // private static readonly object ReadIcon = new object();
public enum IconSize
{
Large = 0, // 32x32 pixels
@@ -38,6 +37,7 @@ namespace SystemTrayMenu.Utilities
Closed = 1,
}
+ // see https://github.com/Hofknecht/SystemTrayMenu/issues/209.
public static bool SingleThread { get; set; }
public static void Dispose()
@@ -74,6 +74,8 @@ namespace SystemTrayMenu.Utilities
key = extension + linkOverlay;
}
+ ClearBadIcons();
+
if (!DictIconCache.TryGetValue(key, out Icon icon))
{
icon = LoadingIcon;
@@ -154,6 +156,8 @@ namespace SystemTrayMenu.Utilities
key = extension + linkOverlay;
}
+ ClearBadIcons();
+
if (!DictIconCache.TryGetValue(key, out Icon icon))
{
icon = LoadingIcon;
@@ -210,6 +214,8 @@ namespace SystemTrayMenu.Utilities
string key = path;
+ ClearBadIcons();
+
if (!DictIconCache.TryGetValue(key, out Icon icon))
{
icon = LoadingIcon;
@@ -351,6 +357,21 @@ namespace SystemTrayMenu.Utilities
return icon;
}
+ ///
+ /// Clear icons which are null.
+ /// see https://github.com/Hofknecht/SystemTrayMenu/issues/209.
+ /// This only happens with the MainPreload method. SingleThread had only partially solved it before.
+ /// It is unclear exactly where the problem comes from, because it never seems to be null later.
+ ///
+ private static void ClearBadIcons()
+ {
+ IEnumerable badKeysList = DictIconCache.Where(x => x.Value == null).Select(x => x.Key);
+ foreach (string badKey in badKeysList)
+ {
+ DictIconCache.Remove(badKey, out _);
+ }
+ }
+
private static bool IsExtensionWithSameIcon(string fileExtension)
{
bool isExtensionWithSameIcon = true;