locked
WM 6.5 App crashs when Power Button was pressed twice to turn on the Display RRS feed

  • Question

  • Hello,

    i have a problem with my CF.NET 2.0 APP on a WM 6.5 Device (Motorola MC65) .

    The App Crash occurs when i use the Power Button to turn the Display on, after the Dsiplay was turned off automatically (or manually by also using the Power Button)

    Why does this happens ?

    What do i need to implement to prevent from this behavior ?

    Thx for any advice!

    Wednesday, August 29, 2012 8:47 AM

Answers

  • Hi tronix01,

    It is not recommended to install your app onto a storage card because there is storage card re-connection issue in windows mobile os when you powering on & off the device. Your app will crash most of the time if not all forms (or other classes) instances are initiated at the beginning (before powering off). 

    For example, if you have a form A which you will instantiate when user press a button in main form, before you press this button, turn off your device and on again and press that button, your system will crash. However, if you instantiate form A while loading main form from the beginning, turning off and on your device wont crash your app, it is because the instance is rendered in memory.

    So install your apps in internal storage will solve your problem, however if you insist to install it on storage card, I suggest you to instantiate all forms and related classes right at the start of your application.

    Hope this helps.

    Sam.

    • Marked as answer by tronix01 Friday, August 31, 2012 9:57 AM
    Thursday, August 30, 2012 4:20 PM
  • That's why it is crashing. Once device goes into sleep mode all handles related to the storage card (including your app file handle) are invalidated.

    Once device resumes application needs to be reloaded from file (as it usually was swapped out) but file handle is no more so it can not be reloaded and crash follows. 

    There's no way for you to "ignore" that, you must move your application (and all it's components including framework if it is on the storage card) to the main memory. 

    You can keep other files such as database files on the storage card. You would need to handle file errors with these files and reopen them upon resume. Or, better, close them before device goes to sleep, e.g. using power notifications.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by tronix01 Friday, August 31, 2012 9:57 AM
    Thursday, August 30, 2012 4:35 PM

All replies

  • Do you have your application, framework or any other files installed on to a storage card? 

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, August 29, 2012 4:06 PM
  • Hello Ilya,

    of course. my app is stored at the storage card and will be exceuted from there.

    In my opinion the app crashes always with the following combination:

    1. start my app

    2. Press the Power Button to turn the Display off

    3. Press the Power Button to turn the Display on 

    4. the app seems to chrash when it try to have access (read, write) the sql compact database

    I implement the RequestPowerNotifications and can retrieve the events when the Power Button is pressed.

    My idea was it to ignore the power button when the app is excuteted by using SetSystemPowerState, but it works only when the device is in the his cradle.

    Thx for any advice

    Thursday, August 30, 2012 7:33 AM
  • Hi tronix01,

    It is not recommended to install your app onto a storage card because there is storage card re-connection issue in windows mobile os when you powering on & off the device. Your app will crash most of the time if not all forms (or other classes) instances are initiated at the beginning (before powering off). 

    For example, if you have a form A which you will instantiate when user press a button in main form, before you press this button, turn off your device and on again and press that button, your system will crash. However, if you instantiate form A while loading main form from the beginning, turning off and on your device wont crash your app, it is because the instance is rendered in memory.

    So install your apps in internal storage will solve your problem, however if you insist to install it on storage card, I suggest you to instantiate all forms and related classes right at the start of your application.

    Hope this helps.

    Sam.

    • Marked as answer by tronix01 Friday, August 31, 2012 9:57 AM
    Thursday, August 30, 2012 4:20 PM
  • That's why it is crashing. Once device goes into sleep mode all handles related to the storage card (including your app file handle) are invalidated.

    Once device resumes application needs to be reloaded from file (as it usually was swapped out) but file handle is no more so it can not be reloaded and crash follows. 

    There's no way for you to "ignore" that, you must move your application (and all it's components including framework if it is on the storage card) to the main memory. 

    You can keep other files such as database files on the storage card. You would need to handle file errors with these files and reopen them upon resume. Or, better, close them before device goes to sleep, e.g. using power notifications.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by tronix01 Friday, August 31, 2012 9:57 AM
    Thursday, August 30, 2012 4:35 PM
  • thx both!

    you are right.

    it works, when i move my app to the internal storage.

    thx again

    cheers

    Friday, August 31, 2012 9:57 AM
  • On Thu, 30 Aug 2012 16:35:21 +0000, Ilya Tumanov [MSFT] wrote:

    That's why it is crashing. Once device goes into sleep mode all handles related to the storage card (including your app file handle) are invalidated.

    Once device resumes application needs to be reloaded from file (as it usually was swapped out) but file handle is no more so it can not be reloaded and crash follows. 

    There's no way for you to "ignore" that, you must move your application (and all it's components including framework if it is on the storage card) to the main memory. 

    Just to be sure:
    I assume "sleep mode" is what happens when the screen goes dark and I need to enter my
    password to get back to the program I was using.

    I regularly use several apps, including two I wrote, that work fine when they and their
    data are stored on a storage card. In fact, I think I've encountered only a half dozen
    programs that have any problems. And my use includes having the device go into sleep mode
    (see above). Commercial apps include
    ALK CoPilot
    DDH HanDBase
    Ilium eWallet (program on storage card, data in main memory)
    Ilium RSS Hub
    Microsoft Reader
    Nomad Pocket Stars
    Panoramic moTweets
    and several others

    As I was checking my programs and how they're installed, I notice a few apps that are
    installed in main memory. I don't remember which are there because they had problems and
    which are there because they're really small.

    The two programs that I have installed on storage card and may have problems are
    Opera Mini
    CreationPal SportyPal

    My experience includes well over a dozen devices using versions of Windows Mobile and its
    predecessors, going  back to Palm-size PC 1.0 and HPC 2.0.

    The bad news is that this has been such a non-issue for me that I have no idea how to
    solve such problems.

    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret
    PenFact, Inc.
    20 Park Plaza, Suite 400
    Boston, MA 02116
    www.penfact.com
    r_z_aret@pen_fact.com
    Useful reading (be sure to read its disclaimer first):
       http://catb.org/~esr/faqs/smart-questions.html

    Thursday, September 6, 2012 5:07 PM