[PT Run] Improve the Win32 Program Indexing speed (#11364)

This commit is contained in:
Roy
2021-06-03 16:11:09 +02:00
committed by GitHub
parent 9a1034e122
commit 266aafb700
7 changed files with 287 additions and 344 deletions

View File

@@ -17,6 +17,31 @@ namespace Microsoft.Plugin.Program.Logger
/// </summary>
internal static class ProgramLogger
{
/// <summary>
/// Logs an warning
/// </summary>
[MethodImpl(MethodImplOptions.Synchronized)]
internal static void Warn(string message, Exception ex, Type fullClassName, string loadingProgramPath, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
{
string calledMethod = "Not available";
if (ex != null)
{
string exceptionCalledMethod = ex.TargetSite != null ? ex.TargetSite.ToString() : ex.StackTrace;
if (!string.IsNullOrEmpty(exceptionCalledMethod))
{
calledMethod = exceptionCalledMethod;
}
}
var msg = $"\n\t\tProgram path: {loadingProgramPath}"
+ $"\n\t\tException thrown in called method: {calledMethod}"
+ $"\n\t\tPossible interpretation of the error: {message}";
// removed looping logic since that is inside Log class
Log.Warn(msg, fullClassName, methodName, sourceFilePath, sourceLineNumber);
}
/// <summary>
/// Logs an exception
/// </summary>
@@ -29,7 +54,7 @@ namespace Microsoft.Plugin.Program.Logger
if (IsKnownWinProgramError(ex, methodName) || IsKnownUWPProgramError(ex, methodName))
{
possibleResolution = "Can be ignored and Wox should still continue, however the program may not be loaded";
possibleResolution = "Can be ignored and PowerToys Run should still continue, however the program may not be loaded";
errorStatus = "KNOWN";
}