From 078cf2c22f20aa3a00d6a4e2c9210ff4f6c18e50 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Thu, 26 Aug 2021 17:35:28 +0100 Subject: [PATCH] [PowerToys Run] Fix register notifications crash (#12911) --- .../launcher/PowerLauncher/PublicAPIInstance.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs b/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs index 52f5f2b1f6..2c246a7e3f 100644 --- a/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs +++ b/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net; +using System.Reflection; using System.Windows; using ManagedCommon; using Microsoft.PowerToys.Common.UI; @@ -16,6 +17,7 @@ using PowerLauncher.ViewModel; using Windows.UI.Notifications; using Wox.Infrastructure.Image; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox { @@ -37,7 +39,14 @@ namespace Wox WebRequest.RegisterPrefix("data", new DataWebRequestFactory()); DesktopNotificationManagerCompat.RegisterActivator(); - DesktopNotificationManagerCompat.RegisterAumidAndComServer("PowerToysRun"); + try + { + DesktopNotificationManagerCompat.RegisterAumidAndComServer("PowerToysRun"); + } + catch (System.UnauthorizedAccessException ex) + { + Log.Exception("Exception calling RegisterAumidAndComServer. Notifications not available.", ex, MethodBase.GetCurrentMethod().DeclaringType); + } } public void ChangeQuery(string query, bool requery = false)