繁体   English   中英

WP7中的UnhandledException

[英]UnhandledException in WP7

在制作WP7应用程序时,我遇到了这个奇怪的错误,我看不出原因。 我得到的唯一输出/错误消息是“UnhandledException:参数不正确。::: ProgramName.App”

此错误随机发生,我没有从调试器获得有关如何解决它的任何信息。 当我运行相同的代码两次,一次得到错误,另一次没有。 所以,你们之前是否有过这个错误,也许可以告诉我它为什么会发生? 这太令人沮丧了,因为它是随机发生的。 任何提案都将受到高度赞赏:)

编辑:这是完整的堆栈跟踪:

at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 index, DependencyObject container, Boolean needPrepareContainer)
at System.Windows.Controls.ItemsControl.AddContainers()
at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)
at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at Microsoft.Phone.Controls.Pivot.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)

我有同样的问题。 对我来说,修复是给每个我想要添加唯一名称的元素(例如Name = Guid.NewGuid()。ToString())。 我希望这对你也有帮助!

单击Debug然后单击Exceptions,然后将Common Language Runtime Exceptions设置为“Thrown”,您应该看到堆栈跟踪。

但是,我确实认为这是一个错误,并且不知道如何在不查看代码/堆栈跟踪的情况下绕过它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM