1

在我的 App() 初始化代码中,我包含了一个通用处理程序

UnhandledException += Application_UnhandledException;

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
Debugger.Break();
}

我有 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 并将调试器设置为在未处理时中断,我会得到以下信息:

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% 的时间,在数十个屏幕之间导航。只有一位用户报告说能够通过在两个屏幕之间快速导航来使应用程序崩溃,然后仅在大约 10 次来回尝试之后

我的问题是:

有什么方法可以确定是什么原因造成的?

有什么办法可以预防吗?

从这个错误中恢复的最佳方法是什么?

4

1 回答 1

6

跟进:

通过命名视图控件解决了该问题,即使不需要这样做

<telnav:RadTabItem.Content>
 <views:Detail_InfoView />
</telnav:RadTabItem.Content>

<telnav:RadTabItem.Content>
 <views:Detail_InfoView x:Name="DetailsInnerView"/>
</telnav:RadTabItem.Content>
于 2011-08-11T05:41:42.763 回答