Skip to content

Commit b29d839

Browse files
committed
Merge branch 'master' into fix_error_message
2 parents 46274ac + 3e14c8e commit b29d839

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ private static bool IsKnownWinProgramError(Exception e, string callingMethodName
111111
private static bool IsKnownUWPProgramError(Exception e, string callingMethodName)
112112
{
113113
if (((e.HResult == -2147024774 || e.HResult == -2147009769) && callingMethodName == "ResourceFromPri")
114-
|| (e.HResult == -2147024894 && callingMethodName == "LogoPathFromUri"))
114+
|| (e.HResult == -2147024894 && (callingMethodName == "LogoPathFromUri" || callingMethodName == "ImageFromPath"))
115+
|| (e.HResult == -2147024864 && callingMethodName == "InitializeAppInfo"))
115116
return true;
116117

117118
if (callingMethodName == "XmlNamespaces")

Plugins/Wox.Plugin.Program/Programs/UWP.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
@@ -86,6 +86,8 @@ private void InitializeAppInfo()
8686
var e = Marshal.GetExceptionForHR((int)hResult);
8787
ProgramLogger.LogException($"|UWP|InitializeAppInfo|{path}" +
8888
"|Error caused while trying to get the details of the UWP program", e);
89+
90+
Apps = new List<Application>().ToArray();
8991
}
9092
}
9193

@@ -196,11 +198,20 @@ private static IEnumerable<Package> CurrentUserPackages()
196198
ps = ps.Where(p =>
197199
{
198200
bool valid;
201+
try
202+
{
203+
var f = p.IsFramework;
204+
var d = p.IsDevelopmentMode;
205+
var path = p.InstalledLocation.Path;
206+
valid = !f && !d && !string.IsNullOrEmpty(path);
207+
}
208+
catch (Exception e)
209+
{
210+
ProgramLogger.LogException("|UWP|CurrentUserPackages|An unexpected error occured and "
211+
+ $"unable to verify if package is valid", e);
212+
return false;
213+
}
199214

200-
var f = p.IsFramework;
201-
var d = p.IsDevelopmentMode;
202-
var path = p.InstalledLocation.Path;
203-
valid = !f && !d && !string.IsNullOrEmpty(path);
204215

205216
return valid;
206217
});

0 commit comments

Comments
 (0)