簡體   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