WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

Our app suddenly fails to show toast notifications

Open reiseder opened this issue 10 months ago • 1 comments

Our app suddenly throws an UnauthorizedAccessException when trying to show a basic toast notification.

It worked fine until a few days ago, so my question would be if this was cause by a Windows update or just our IT department changing something?

The app runs with elevated rights.

It would be great if anybody knows what this registry key is used for?


Exception message:

Failed initializing notifications

Stack trace:

   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat.CreateToastNotifier()
   at Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder.Show(CustomizeToast customize)
   at Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder.Show()
   at <REDACTED METHOD> in <REDACTE FILE>:line 200
   at <REDACTED METHOD> in <REDACTE FILE>:line 172
   at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

Inner exception message:

Access to the registry key 'HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{5a99e422-303c-ea88-3583-506ae78a9819}\LocalServer32' is denied.

Inner exception stack trace:

   at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
   at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions)
   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat.RegisterComServer(Type activatorType, String exePath)
   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat.RegisterActivator(Type activatorType)
   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat.CreateAndRegisterActivator()
   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat.Initialize()
   at Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat..cctor()

This is how we show the toast notification

private void ShowMessage(string message)
{
    new ToastContentBuilder()
        .AddArgument("action", "viewConversation")
        .AddArgument("conversationId", SomeIdProperty)
        .AddText(SomeProductNameProperty)
        .AddText(message)
        .Show();
}

reiseder avatar Mar 07 '25 11:03 reiseder

+1

1592363624 avatar May 22 '25 06:05 1592363624