Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ToastNotifier.GetScheduledToastNotifications() throws "Element not found" (Exception from HRESULT: 0x80070490)

I've noticed in my telemetry data that the following code sometimes results in an exception "System.Exception: Element not found. (Exception from HRESULT: 0x80070490)"

var notifier = ToastNotificationManager.CreateToastNotifier();
var notifications = notifier.GetScheduledToastNotifications();

The code is run inside a Windows Phone 8.1 (WinPRT) application on a background thread and the exception is thrown quite sparsely.

Any ideas what might be causing this or additional information I can provide?

like image 359
Jan Kratochvil Avatar asked Mar 28 '15 09:03

Jan Kratochvil


1 Answers

I had the same problem.

It took a long time to figure out, but it's a really easy fix :

"The exception is because you need to provide an applicationId in CreateToastNotifier()"

( Windows 10: Showing a toast Notification )

like image 187
MGamsby Avatar answered Sep 18 '22 20:09

MGamsby