Skip to content

Commit

Permalink
Add AppResolver tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
riverar committed Mar 12, 2024
1 parent dcdc1b4 commit 2fb25ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ public DesktopAppInfo(int processId, bool trackProcess)

try
{
Trace.WriteLine($"DesktopAppInfo Attempting AppID resolve for pid {processId}");

var appResolver = (IApplicationResolver)new ApplicationResolver();
appResolver.GetAppIDForProcess((uint)processId, out string appId, out _, out _, out _);
Marshal.ReleaseComObject(appResolver);

Trace.WriteLine($"DesktopAppInfo Attempting display name read for AppID {appId}");

var shellItem = Shell32.SHCreateItemInKnownFolder(FolderIds.AppsFolder, Shell32.KF_FLAG_DONT_VERIFY, appId, typeof(IShellItem2).GUID);
DisplayName = shellItem.GetString(ref PropertyKeys.PKEY_ItemNameDisplay);
}
Expand Down
8 changes: 8 additions & 0 deletions EarTrumpet/Diagnosis/ErrorReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Input;

namespace EarTrumpet.Diagnosis
{
Expand All @@ -22,6 +24,12 @@ public ErrorReporter(AppSettings settings)
Trace.Listeners.Clear();
Trace.Listeners.Add(_listener);

if (Keyboard.IsKeyDown(Key.LeftAlt))
{
Trace.Listeners.Add(new TextWriterTraceListener(Path.Combine(Path.GetTempPath(), "EarTrumpetTrace.log")));
Trace.AutoFlush = true;
}

if (_settings.IsTelemetryEnabled)
{
try
Expand Down

0 comments on commit 2fb25ee

Please sign in to comment.