4

Is there any way to write an error handler for all otherwise unhandled exceptions in a .NET CF 3.5 app? I don't see any kind of OnError event (or any events) on the compact Application class.

Searching on google only seems to bring up references to global error handling in ASP.NET, which does not help me, as this is a fat-client handheld app.

eidylon
  • 7,068
  • 20
  • 75
  • 118

1 Answers1

5

Handle the AppDomain.Current.UnhandledException event.

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • Looks like what I need. Reading through that doc though, it sounds like this event does not let you actually recover from the error, but only log/track it. Do you know whether this event will actually let you **recover** from an error? – eidylon Mar 24 '11 at 16:48
  • You cannot recover, no. If you misssed an exception, the app is in an unstable state, so how would you unwind it anyway? – ctacke Mar 24 '11 at 17:39
  • 1
    Well, our client queries methods on web-services. However it appears the web-service client generated by Visual Studio, and its underlying framework, are not properly closing connections after requests. This leads to some sort of problem with SYN/ACKs on the network. The framework IS however getting a new request properly, so this old request just hangs around in the wings, and eventually throws an ObjectDisposed excpetion, which doesn't affect the functioning of the app, other than to toss up an UnhandledException dialog and cause it to terminate, even though the app itself was working fine. – eidylon Mar 24 '11 at 17:49