What usually means that the HRESULT E_FAIL error was returned from a call to the COM component.?

I have a specific view with a DataGrid (silverlight 4). But I have a project in which resources were combined with another project (for feedback support). Now, after this merge, I get this error whenever I try to add a new line to my ObservableCollection .... my theory is that this is something wrong with xaml (which I can touch!) Or, I hope , combined resources (styles and brushes).

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: 
+6
source share
1 answer

This usually means that a problem with your XAML cannot be verified at design time, but will occur at runtime. Given your scenario, I assume that the row being added may result in an error in one of the Datagrid column templates.

This is usually associated with a reference to a style or event handler that does not exist or is not in the XAML context. In my experience, this is a common occurrence in the development of user controls.

See my answer to a similar question here .

NTN.

+20
source

Source: https://habr.com/ru/post/890257/


All Articles