Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone 8.1 App Crashes When Not Debugging Async Await

I am working on a Windows Phone 8.1 application. I am about a month into the project and have seen little to no issues with what I have written so far.

I decided to do some testing on the application without running it through the VS 2013 debugger. Now, for some reason, the app crashes before it gets to the first screen. I get no exceptions or messages whatsoever(I am using Raygun for error logging).

I am using async methods throughout(some async void, others async Task), but all of this works when debugging.

The main thing that would help, is to get some sort of error message. I've been reduced to commenting out sections of code, but ultimately this is getting me nowhere because it seems when I think I've found the issue, I get another crash further down into the code.

At one point, I found an issue with calling: ListView.UpdateLayout(). I commented this out and the app would run properly no crashes. I then un-commented some code further down and now it's crashing again.

If anyone knows of a way to get exceptions from the phone or if someone has experienced this issue before, any help would be greatly appreciated. I can provide any further information that is needed.

UPDATE: I think I have narrowed the issue down to Sqlite.NET. I am using Sqlite.Net for WinRT along with an extension called SqliteNetExtensions. The particular statement is

    DataContext.Context.Connection.Table<Message>().Where(m => m.ChannelID == channelID && m.ChannelID.Contains("C")).ToList();

If I comment this out, the app runs with no problems. This LINQ statement at most returns 100 records. I would not think that a 100 record SELECT statement could cause the app to crash, but it seems like the culprit. Any ideas on how to optimize Sqlite.NET?

UPDATE 2: Finally figured it out! It was not SQLite at all. It was not my code at all. It was my phone. I am running a Nokia Lumia Icon. I had installed Rudy Huyn's Lockscreen Beta a few weeks back. It caused some issues when I uninstalled it but it wasn't related to my application. Today, I had my business partner install my app on his phone, he has the same model phone. The app was about 50x faster and did not crash. I restored my phone from factory and, lo and behold, it ran perfectly. So, pro tip: DO NOT INSTALL LOCKSCREEN BETA BY RUDY HUYN!!!

like image 959
John Murphy Avatar asked Sep 05 '14 20:09

John Murphy


1 Answers

As an aside, I would take the time to ensure you always avoid using async void. It is well documented that async void is often a recipe for trouble.

There is a good article on the disadvantages shown here

like image 190
obaylis Avatar answered Oct 20 '22 08:10

obaylis