سؤال

I've got a Silverlight 5 application that can work in browser and out of browser. When run out of browser, it should be able to use previously downloaded data (XMLs and JPGs) to work without an Internet connection.

Currently it works, but I've got an unhandled exception during startup (that gets caught by my Application's UnhandledException event handler) that is shown to the user with a frightening message - something like 'Internal error - the application may crash now.' with optional details being 'E_UNEXPECTED'. The error occurs both on my dev machine and on others, including a client using MacOS X.

Of course, I could change the message, but that's not the point.

So my question: what could be causing an error only when starting offline, error which, when caught by an UnhandledException handler, doesn't seem to affect application stability?

هل كانت مفيدة؟

المحلول

I found the culprit (by logging my startup steps): it's the check for updates.

If I call Application.CheckAndDownloadUpdateAsync() when there is no connection available, I get this exception. If I check whether a connection is available(*) before launching the check for updates, the exception disappear.

This is not documented in http://msdn.microsoft.com/en-us/library/dd730310%28VS.95%29.aspx so it looks like a bug in the Silverlight runtime.

(*) Based mostly on NetworkInterface.GetIsNetworkAvailable(), plus some custom checks.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top