Unexpected exit of application for Windows phone without any exceptions

I have a Windows pone application that works quite well, unless it returns from Tombstonning and then quits rather randomly after executing the same command several times.

I set VS2012 to pause on any exception for the first chance, but nothing happens:

enter image description here

I also have handlers for the following events:

this.application.UnhandledException += this.OnApplicationUnhandledException; this.application.RootFrame.NavigationFailed += this.OnRootFrameNavigationFailed; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; 

None of the handlers are called: S

The only information I have is the next line in the output, which means nothing to me. Any help would be really good, thanks.

 The program '[1040] TaskHost.exe' has exited with code -2147483645 (0x80000003). 

EDIT: Finally, I tracked the problem down to the following line:

 Contract.Requires<ArgumentNullException>(bitmap != null, "Bitmap cannot be null."); 

The application exits even if the bitmap variable is not equal to zero. Any idea?

+4
source share
2 answers

This seems to be a defect in the CodeContracts API.

Vocation:

 Contract.Requires<ArgumentNullException>(bitmap != null, "Bitmap cannot be null."); 

forces the application to sometimes exit (an event with a bitmap is not null) with only information:

The program '[1040] TaskHost.exe' exited with the code -2147483645 (0x80000003).

+2
source

Interestingly, this is not the only case when an unexpected exit occurs. In my case, this is due to a combination of WebBrowser control, Microsoft AdControl and UploadOperation / DownloadOperation. If I take at least one of these things from the equation, the application will become quite stable, but with all of them in the application immediately it can exit unexpectedly at almost any time: when you scroll the control content of WebBrowser, when you pause or resume DownloadOperation, when the contents of AdControl updated, at the same time something changes on the screen. In my case, the error code is 1. It is interesting how to approach the study of such a problem in order to find a more or less accurate cause and try to minimize the probability of an exit. I definitely cannot completely remove the WebBrowser or AdControl or DownloadOperation / UploadOperation control, but potentially I could "rebuild" something so to speak, but what and where?

+1
source

Source: https://habr.com/ru/post/1486497/


All Articles