如何从 Silverlight UnhandledException 中恢复

发布于 2024-11-25 05:23:25 字数 1630 浏览 1 评论 0原文

在我的 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 次来回尝试后才能使应用程序崩溃。

我的问题是:

有什么方法可以确定导致该问题的原因吗?

有什么办法可以预防吗?

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

In my App() initialization code, I include a generic handler

UnhandledException += Application_UnhandledException;

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

I have 2 screens that work fine, but when navigating quickly back and forth between the two screens a number of times (varies between 7 and 12) I hit this breakpoint with the exception

{System.Windows.ApplicationUnhandledExceptionEventArgs}   base {System.EventArgs}:   {System.Windows.ApplicationUnhandledExceptionEventArgs}  
    ExceptionObject: {System.ArgumentException: Value does not fall within the expected range.}  
    Handled: false  

and if I remove the UnhandledException and set the Debugger to break on unhandled, I get the following:

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  

even if I set e.handled = true, my application crashes.

Important Note:
The application, under a MVVM framework works over 99.9% of the time, navigating between dozens of screens. Only one user has reported being able to crash the application by quickly navigating between two screens, and then only after about 10 back and forth tries

My questions are:

Any way to determine what is causing it?

Any way to prevent it?

What is the best way to recover from this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰◇生如夏花灿烂 2024-12-02 05:23:25

后续:

通过命名视图控件解决了问题,尽管不需要

from

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

to

<telnav:RadTabItem.Content>
 <views:Detail_InfoView x:Name="DetailsInnerView"/>
</telnav:RadTabItem.Content>

Followup:

The problem was solved by naming the view control, even though that should not be needed

from

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

to

<telnav:RadTabItem.Content>
 <views:Detail_InfoView x:Name="DetailsInnerView"/>
</telnav:RadTabItem.Content>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文