1

I am developing a windows mobile application in c# that makes calls to a web service on a separate thread to the UI. This thread runs every few minutes triggered by a timer.

My problem is that if the hand held device goes to sleep, when it wakes up the OS seems to unload the networking and then restart the networking a second or so later.

The result of this more often than not is my application crashes.

Has anyone experienced a similar scenario?

Has anybody had to code around this problem?

Any help or comments would be gratefully received.

Thanks

JDibble
  • 744
  • 1
  • 8
  • 25

1 Answers1

0

It sounds like you should add some exception handling on your thread.

Surround your networking code with a try catch block and retry the operation later:

try {
    // your code 
}
catch (Exception ex)
{
    // add some logging
}
Jan
  • 15,802
  • 5
  • 35
  • 59
  • I do have some exception handling in place as a kind of catch all to write out to a log file. Your suggestion to catch things at a lower level and retry is worth exploring. Thanks – JDibble Oct 18 '11 at 19:21
  • 2
    When your app crashes you definitly have some unhandled exception throwing. – Jan Oct 18 '11 at 19:25
  • I have put some exception handling and logging around all my web service calls. All seems to be working fine. Thanks for you guidance. – JDibble Oct 19 '11 at 08:56