WP8异常错误:Error HRESULT E_FAIL has been returned from a call to a COM component.

在做WP8开发的过程中,使用到了longlistselector这个控件,本来使用没有问题。

但是突然出现了一个闪退的错误,错误信息如下:

{MS.Internal.WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at Microsoft.Phone.Controls.LongListSelector.RealizeDisplayItem(Iterator`1 iterator, RealizeOptions options)
at Microsoft.Phone.Controls.LongListSelector.RealizedRange.Append(RealizedRange nextRange, Double bottom)
at Microsoft.Phone.Controls.LongListSelector.AppendElement(RealizedRange range, RealizedRange nextRange, Double bottom)
at Microsoft.Phone.Controls.LongListSelector.HealElements(Rect requireRect, Rect allowRect, Boolean& areBoundsUpdated)
at Microsoft.Phone.Controls.LongListSelector.Balance()
at Microsoft.Phone.Controls.LongListSelector.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
--- End of inner exception stack trace ---}

看似很复杂,搞得我也不知道从何下手。

回想整个开发过程,之前使用正常,后面闪退,期间做了全局资源命名的调整,但是vs没有给出错误提示,本以为替换完毕(其实应该全局查找替换的)。

但遗漏了一个地方,longlistselector中的HeaderDataTemplate中的一个资源使用的地方。

在做了更改后,使用又恢复正常了。

posted on 2014-03-15 11:52  Tony.Works  阅读(2279)  评论(3编辑  收藏  举报