Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinJS app with an uncatchable crash

I have random crashes in my WinJS application when navigating between pages.

The problem is that these crashes never occurs when the app is attached to the Visual Studio debugger; so I can't find where they come from.

I use the WinJS.Application.onerror event to prevent crashes, and log what happens, but as this works well when I try with a random exception, my "uncatchable" crashes doesn't seem to fire this event (I don't have anything logged).

Do you have any idea of what could cause these crashes, or any solution to find more informations ?

like image 939
glacasa Avatar asked Jan 15 '23 19:01

glacasa


2 Answers

Sometimes errors can't fire the WinJS.Application.onerror for several reasons (in my app, the problem was in an iframe, in a page not using winjs).

When it happens, errors can be found in the event log, under "administrative events"

Found this on this link : http://www.davepaquette.com/archive/2012/09/15/windows-8-store-app-crash-logs.aspx

like image 185
glacasa Avatar answered Apr 21 '23 07:04

glacasa


Jason gives a good solution to this problem in this video (start at time 14:48). In his example, the app was crashing if you had a callback and navigated to a different page before the callback completed. Could this be the case for your app? Any more details on what is going on when you navigate?

For others (since it seems you already know about this!):

To be able to debug easier, use the WinJS.Application.OnError event. Wire up an event handler that dumps out information about the problem before the app crashes.

WinJS.Application.onerror = function (info) {
   var err = {
     errorMessage: info.detail.errorMessage,
     errorUrl: info.detail.errorUrl,
     errorLine: info.detail.errorLine,
     errorCharacter: info.detail.errorCharacter,
   };

   Windows.Storage.ApplicationData.current.localFolder
      .createFileAsync("crash.txt", Windows.Storage.CreationCollisionOption.openIfExists)
      .then(function (file) {
         Windows.Storage.FileIO.appendLinesAsync(file, [JSON.stringify(err)]);
      });
};
like image 24
Jennifer Marsman - MSFT Avatar answered Apr 21 '23 07:04

Jennifer Marsman - MSFT