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

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?

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 )

Maybe late to the party, but in my case it was caused by the fact that I was removing some scheduled toasts in another thread at that moment.

Related

EmailManager.ShowComposeNewEmailAsync Exception The parameter is incorrect 'User'

My UWP apps suddenly throw the following exception on Win 10 Mobile Build 10.0.14342.1001. They still work fine in the emulators.
Is anybody experiencing the same problem? Is there a workaround?
Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
WinRT information: user
Additional information: The parameter is incorrect.
user
To ensure the problem is not related to something specific with the apps email messages I sent the following simple message which causes the same problem.
Dim em As New Windows.ApplicationModel.Email.EmailMessage
em.To.Add(New EmailRecipient("a#b.c"))
em.Subject = "test"
Await EmailManager.ShowComposeNewEmailAsync(em)
Link to test case.
This is a bug in the insider build. No workaround known.
MS was informed about it via feedback and the MS forum.
Got fixed with Windows 10 Mobile Insider Preview Build 14356.
Build 14342 is an insider 'fast' build, meaning it is not production-ready and you are likely to hit errors from time to time. Please file feedback using the Feedback Hub, and wait for the next build. Thanks for being an Insider!

LoadListingInformationAsync throws a FileNotFound exception

I have a customer who is unable to do in-app purchasing from one of my Windows 8.1 Store apps.
Looking at the logs, I see that the call to load listing information:
await CurrentApp.LoadListingInformationAsync();
throws a FileNotFound exception
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)'
Any idea why this exception is being thrown?
We have less than 100 in-app purchasing items.
Can you reproduce this on your device? I would suggest to run it on the UI thread: Deployment.Current.Dispatcher.BeginInvoke(() => await CurrentApp.LoadListingInformationAsync());

Asynchronous download with HttpClient: The text associated with this error code could not be found

I intend to use the following code to download a file. It works when WIFI is available; but when there is no Wifi, I expect to catch the exception raised in the previousTask.get(). Unfortunately, catch in my code doesn't seem to catch the exception. The exception is HRESULT:0x80072F30 The text associated with this error code could not be found., by the way. Am I missing something like the exception is uncaughtable?
auto httpClient = ref new HttpClient();
auto get_operation = httpClient->GetAsync(ref new Uri(url), HttpCompletionOption::ResponseContentRead);
get_operation->Progress = progressHandler;
auto response = create_task(get_operation).then([](task<HttpResponseMessage^> previousTask)
{
try
{
return previousTask.get();
}
catch (Exception^ ex)
{
// Some how this does not catch
OutputDebugString(("Exception: " + ex->Message)->Data());
return (HttpResponseMessage^)nullptr;
}
}).get();
// At this point, I expect either a fully read response or response=nullptr
// Code to write to file is omitted
EDIT: ~~I tested the official Microsoft's HttpClient sample which apparently use similar code. Apparently, the same crash occurs in that app when there is no network connection. This sort of confirms that the defect is in the OS side and there's nothing one can do about it.~~
EDIT: It turns out that I thought the exception was not caught because Visual Studio pops up a dialog and I assume that means in reality the exception crashes the app i.e. when it is not launched via VS. I read the pop up message carefully and realize that VS prompts on every Exception thrown unless configured not to do so; pressing [Continue] button on the dialog goes to the catch clause. Launching app from Start menu poses no problem.
If this code is called from the UI thread then remove the get() call from the last line of this code. You can't do that in a UI thread.
Otherwise your code works fine for me with Airplane mode turned on; as expected I catch the exception in the handler. The exception has an HResult of 0x80072f30, which is documented on the MSDN page as ERROR_WINHTTP_NO_CM_CONNECTION

Getting AIR stacktraces in ipad for release build [duplicate]

I'm trying to debug an issue on a clients machine. The problem is that the problem is a runtime error with very little clue as to where it is. It is an intermittent problem. I know ADL allows me to run the application in a debug mode. The problem is that to tell the user to download and manage the ADL invokation is going to be very difficult. It would be a lot easier if I could just give the end user one install/executable to install and run and then send me the trace of the issue. So what I'm looking for is easy steps for the client to be able to run the AIR app in debug mode. Downloading ADL and finding the install location of the app is going to be difficult to manage remotely with the end user.
Update:
You have to make sure you are working with AIR 3.5 and Flash 11.5 and also include the following flag "-swf-version=18" in additional compiler settings. You then have to catch the global error as mentioned in the answer and it will show you the location of the error. No line numbers of course. Just routine names. Thanks a milion to Lee for the awsome answer.
not a direct answer but if you publish for AIR3.5 (or 3.6 beta), you can get some debug info:
add a listener for uncaught RTEs to top level of your app:
this.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, globalErrorHandler);
and grab debug info from error in listener:
function globalErrorHandler(event:UncaughtErrorEvent):void
{
var message:String;
//check for runtime error
if (event.error is Error)
message = (event.error as Error).getStackTrace();
//handle other errors
else if (event.error is ErrorEvent)
message = (event.error as ErrorEvent).text;
else
message = event.error.toString();
//do something with message (eg display it in textfield)
myTextfield.text = message;
}
getStackTrace will return a stack trace even for release AIR apps (as long as you use AIR3.5 or above).
Without the SDK Tools; I don't think it is possible to run an aIR app in debug mode. But, here are a few alternatives to consider:
The client must have some idea what is going on to cause the error, right? Can you give them a special build with Alert Boxes or logging or something to help isolate the error to a line of code?
Can you listen for the uncaughtException event? The event will give you the full stack trace ( Error.getStackTrace() ); which you could then log--possibly with other information. Then you just have to tell your client to "Go here" and "send me this file." Or even display the info in some Alert and have the user copy and paste it into an email to you. More info on uncaughtException here and here
check my post. Maybe it helps you to get stack trace with line numbers in a AIR release build.
How can I get stacktrace for Adobe AIR global runtime errors in non-debug mode?
I use it in 2 big projects right now and it works very well.
Greetings

WebBrowser.Navigate(...) throws COMException

I'm developing an Internet Explorer command button that will open a specific web page once clicked. Here's a snippet of code (IEApp is a reference to an instance of IE.WebBrowser):
IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);
The above line throws the following COMException:
Exception Source: Interop.SHDocVw
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: The requested resource is in use. (Exception from HRESULT: 0x800700AA)
Exception Target Site: Navigate
This wasn't a problem on IE6 or IE7. Any ideas on what's going wrong? I'm using AddInExpress for creating the command button.
Cheers!
Christian
That's ERROR_BUSY usually happens when IE is doing something else, e.g. displaying a window.alert message box.
Try suppress script errors and Implement IDocHostShowUI and return S_OK without blocking the message pump
could this help: turning off UAC in Windows, if you are using a server kind version:
screen-shoots here: http://blog.vincentbrouillet.com/post/2011/02/10/watin%3A-The-requested-resource-is-in-use
I had this error, and it was quite random. I tried killing IE before running the tests. It kind of work, but not all the time.