WinJS application with fatal failure

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

The problem is that these crashes never occur when the application is connected to the Visual Studio debugger; therefore, I cannot find where they came from.

I use the WinJS.Application.onerror event to prevent crashes and log what happens, but since it works well when I try to throw a random exception, my โ€œelusiveโ€ crashes don't seem to fire this event (I have nothing registered )

Do you have any idea what could lead to these failures or to any solution to find more information?

+4
source share
3 answers

Sometimes errors cannot trigger WinJS.Application.onerror for several reasons (in my application, the problem was in the iframe, on a page that does not use winjs).

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

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

+5
source

Jason gives a good solution to this problem in this video (starting at 14:48). In his example, the application crashes if you had a callback and went to another page before the callback ended. Could this be the case for your application? What is more information about what happens when navigating?

For others (since it looks like you already know about it!):

To facilitate debugging, use the WinJS.Application.OnError event . Attach an event handler that uploads information about the problem before the application 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)]); }); }; 
+4
source

The final stop for exceptions in JavaScript is actually window.onerror; not every exception will be thrown through WinJS.Application.onerror. Try connecting window.onerror directly.

0
source

All Articles