当前位置: 首页 > 编程语言 > C#

WP7中的UnhandledException分享

时间:2023-04-11 11:36:12 C#

WP7中的UnhandledException在制??作WP7应用程序时,遇到了这个奇怪的错误,看不出原因。我得到的唯一输出/错误消息是“UnhandledException:Incorrectparameter.::ProgramName.App”这个错误是随机发生的,我没有从调试器中得到任何关于如何修复它的信息。当我两次运行相同的代码时,一次出现错误,另一次却没有。那么,你们中有没有人以前遇到过这个错误,也许可以告诉我为什么会这样?这非常令人沮丧,因为它是随机发生的。任何建议将受到高度赞扬:)编辑:这是完整的堆垛跟踪:atMS.Internal.XcpImports.CheckHResult(UInt32hr)atMS.Internal.XcpImports.Collection_AddValue[T](PresentationFramework,Collectionvalue)atcollection`1MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1集合,DependencyObject值)在System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject值)在System.Windows.Controls.UIElementCollection.AddInternal(UIElement值)在System.Windows.PresentationFrameworkCollection`1.Add(UIElement值)在System.Windows.Controls.ItemsControl.AddVisualChild(Int32索引、DependencyObject容器、布尔值needPrepareContainer)在System.Windows.Controls.ItemsControl.AddContainers()在System.Windows.Controls。ItemsControl.RecreateVisualChildren(IntPtrunmanagedObj)在MS.Internal.XcpImports.MeasureOverrideNative(IntPtr元素,单inWidth,单inHeight,单&outWidth,单&outHeight)在MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement元素,可用大小)在System.Windows.FrameworkElement.MeasureOverride(可用大小)在Microsoft.Phone.Controls.Pivot.MeasureOverride(Size.Failmement.Eworkle)MeasureOverride(IntPtrnativeTarget,DoubleinWidth,DoubleinHeight,Double&outWidth,Double&outHeight)我遇到了同样的问题我的解决方法是给每个我想添加唯一名称的元素(例如Name=Guid.NewGuid().ToString()).我希望这对你也有帮助!单击Debug,然后单击Exceptions,然后将CommonLanguageRuntimeExceptions设置为“Thrown”,您应该会看到堆栈跟踪。但是,我确实认为这是一个错误,如果不查看代码/堆栈跟踪就无法判断如何绕过它以上是我与C#学习教程:WP7中的UnhandledException分享的所有内容,如果它对任何人都有用并且需要了解更多C#学习教程,希望大家多多关注~本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处: