Xaml 这通常意味着什么,调用COM组件时返回错误HRESULT E_FAIL。?

Xaml 这通常意味着什么,调用COM组件时返回错误HRESULT E_FAIL。?,xaml,silverlight-4.0,hresult,Xaml,Silverlight 4.0,Hresult,我有一个数据网格(Silverlight4)的特殊视图。但我有一个项目,其中资源已与另一个项目合并(用于向后支持)。现在,在这个合并之后,每当我尝试向ObservableCollection添加新行项目时,我都会遇到这个错误。。。。我的理论是xaml(我可以触摸!)或者,希望合并的资源(样式和画笔)有问题 MS.Internal.WrappedException未由用户代码处理 Message=调用COM组件返回错误HRESULT E_FAIL。 堆栈跟踪: 在MS.Internal.XcpIm

我有一个数据网格(Silverlight4)的特殊视图。但我有一个项目,其中资源已与另一个项目合并(用于向后支持)。现在,在这个合并之后,每当我尝试向ObservableCollection添加新行项目时,我都会遇到这个错误。。。。我的理论是xaml(我可以触摸!)或者,希望合并的资源(样式和画笔)有问题

MS.Internal.WrappedException未由用户代码处理
Message=调用COM组件返回错误HRESULT E_FAIL。
堆栈跟踪:
在MS.Internal.XcpImports.CheckHResult(UInt32小时)
在MS.Internal.XcpImports.UIElement_处测量(UIElement元素,可用大小大小)
位于System.Windows.UIElement.Measure(可用大小大小)
在System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32插槽、UIElement元素、Boolean wasNewlyAdded、Boolean updateSlotInformation)
在System.Windows.Controls.DataGrid.OnAddedElement_Phase1(Int32插槽,UIElement)中
在System.Windows.Controls.DataGrid.OnInsertedElement_Phase1(Int32插槽、UIElement元素、布尔isCollapsed、布尔isRow)
位于System.Windows.Controls.DataGrid.InsertElement(Int32插槽,UIElement元素,布尔更新CrollBarOnly,布尔合并,布尔isRow)
位于System.Windows.Controls.DataGrid.InsertElementAt(Int32插槽、Int32行索引、对象项、DataGridRowGroupInfo组信息、布尔值已合并)
位于System.Windows.Controls.DataGrid.InsertRowAt(Int32行索引)
位于System.Windows.Controls.DataGridDataConnection.NotifyingDataSource\u CollectionChanged(对象发送方,NotifyCollectionChangedEventArgs e)
位于System.Windows.Data.PagedCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs)
位于System.Windows.Data.PagedCollectionView.ProcessAddEvent(对象AddItem,Int32 addIndex)
位于System.Windows.Data.PagedCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs)
在System.Windows.Data.PagedCollectionView.b__0(对象发送方,NotifyCollectionChangedEventArgs args)
位于System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
位于System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32索引,T项)
位于System.Collections.ObjectModel.Collection`1.Add(T项)
内部异常:
Message=调用COM组件返回错误HRESULT E_FAIL。
堆栈跟踪:
在MS.Internal.XcpImports.CheckHResult(UInt32小时)
在MS.Internal.XcpImports.FrameworkElement_测量值超过(FrameworkElement元素,可用大小大小)
位于System.Windows.FrameworkElement.MeasureOverride(可用大小Size)
在System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget、单内宽、单内高、单外宽、单外高)
内部异常:

这通常意味着您的XAML存在一个无法在设计时验证但会在运行时显示的问题。根据您的场景,我猜您添加的行可能会导致Datagrid列模板之一以这种方式出错

这通常是由于对不存在或不在XAML上下文中的样式或事件处理程序的引用。根据我的经验,这是自定义控件开发中常见的情况

请看我对类似问题的回答


HTH.

听起来好像你发现了一个真正的bug。尝试创建一个尽可能简单的项目来重现问题。使用Microsoft的Connect站点进行报告。你也可以考虑在微软公司自己的Silverlight论坛上重复这个问题,MSFT支持CHAPIES在那里更活跃。链接不再工作,也许还有其他方法链接到它?
MS.Internal.WrappedException was unhandled by user code
  Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
  StackTrace:
       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 System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32 slot, UIElement element, Boolean wasNewlyAdded, Boolean updateSlotInformation)
       at System.Windows.Controls.DataGrid.OnAddedElement_Phase1(Int32 slot, UIElement element)
       at System.Windows.Controls.DataGrid.OnInsertedElement_Phase1(Int32 slot, UIElement element, Boolean isCollapsed, Boolean isRow)
       at System.Windows.Controls.DataGrid.InsertElement(Int32 slot, UIElement element, Boolean updateVerticalScrollBarOnly, Boolean isCollapsed, Boolean isRow)
       at System.Windows.Controls.DataGrid.InsertElementAt(Int32 slot, Int32 rowIndex, Object item, DataGridRowGroupInfo groupInfo, Boolean isCollapsed)
       at System.Windows.Controls.DataGrid.InsertRowAt(Int32 rowIndex)
       at System.Windows.Controls.DataGridDataConnection.NotifyingDataSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Windows.Data.PagedCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.PagedCollectionView.ProcessAddEvent(Object addedItem, Int32 addIndex)
       at System.Windows.Data.PagedCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.PagedCollectionView.<.ctor>b__0(Object sender, NotifyCollectionChangedEventArgs args)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
InnerException: 
       Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
       StackTrace:
            at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
            at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
            at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
            at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       InnerException: