App() 初期化コードに、汎用ハンドラーを含めます
UnhandledException += Application_UnhandledException;
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
Debugger.Break();
}
正常に動作する 2 つの画面がありますが、2 つの画面間を何度も (7 から 12 の間で異なります) すばやく移動すると、例外を除いてこのブレークポイントにヒットします。
{System.Windows.ApplicationUnhandledExceptionEventArgs} base {System.EventArgs}: {System.Windows.ApplicationUnhandledExceptionEventArgs}
ExceptionObject: {System.ArgumentException: Value does not fall within the expected range.}
Handled: false
UnhandledException を削除し、Debugger を unhandled で中断するように設定すると、次のようになります。
Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Windows.Markup.XamlParseException: 2028 An error has occurred. [Line: 0 Position: 0] ---> System.ArgumentException: [Arg_ArgumentException]
Arguments: Debugging resource strings are unavailable.
Often the key and arguments provide sufficient information to diagnose the problem.
See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60531.0&File=mscorlib.dll&Key=Arg_ArgumentException
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection
を設定してもe.handled = true
、アプリケーションがクラッシュします。
重要な注意:
アプリケーションは、MVVM フレームワークの下で、99.9% 以上の時間で動作し、多数の画面間を移動します。たった 1 人のユーザーが、2 つの画面間をすばやく移動してアプリケーションをクラッシュさせることができたと報告しています。
私の質問は次のとおりです。
原因を特定する方法はありますか?
それを防ぐ方法はありますか?
このエラーから回復する最善の方法は何ですか?