This is a migrated thread and some comments may be shown as answers.

Error HRESULT E_FAIL has been returned from a call to a COM component.

8 Answers 241 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hammad
Top achievements
Rank 1
Hammad asked on 19 Jan 2011, 09:18 AM
Hi,

I have a RadTreeView in my SL application, i am trying to remove an item from the TreeView but i get this exception

Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Exception occurred
  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.Collection_RemoveAt[T](PresentationFrameworkCollection`1 collection, UInt32 index)
       at System.Windows.PresentationFrameworkCollection`1.RemoveAtImpl(Int32 index)
       at System.Windows.Controls.ItemCollection.RemoveAtImpl(Int32 index)
       at System.Windows.Controls.ItemCollection.RemoveImpl(Object value)
       at System.Windows.Controls.ItemCollection.RemoveInternal(Object value)
       at System.Windows.PresentationFrameworkCollection`1.Remove(T value)
       at Transforms.Page.btn1_Click(Object sender, RoutedEventArgs e)
  InnerException:

Any ideas? Workarounds etc??

8 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 19 Jan 2011, 02:40 PM
Hi Hammad,

This Exception can occur in wide variety of situations, so could you please elaborate more on your scenario. It would be best if you send us a runnable sample and we could provide you with an advice much faster.

Best wishes,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Hammad
Top achievements
Rank 1
answered on 19 Jan 2011, 03:05 PM
Hi,

The item i am trying to remove has some RadTreeViewItem as childs, with Visibility property set to collapsed, when there is no such item in the RadTreeViewItem, it is removed sucessfully.

0
Petar Mladenov
Telerik team
answered on 19 Jan 2011, 04:22 PM
Hi Hammad,

I am unable to reproduce your issue in various basic scenarios. Supposing you scenario is more complex , we definitely need more info on how the tree is bound, whether virtualization is used, how the add/remove operations are implemented and etc.. But still, the best way for us to investigate in depth is to view a runnable sample demonstrating the issue you have come up with.

Regards,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
JJ Loubser
Top achievements
Rank 1
answered on 17 Mar 2011, 12:20 PM
 Row_.IsExpanded = oldRow_.IsExpanded;

when  Row_.IsExpanded = false then set to true. Why?

sometimes it worked, sometimes it gives this error:

Error HRESULT E_FAIL has been returned from a call to a COM component.



in

http://www.telerik.com/community/forums/silverlight/treelist/radtreelistview-containerbinding-not-binding.aspx



0
Aleksey Dyomin
Top achievements
Rank 1
answered on 11 Aug 2011, 01:19 PM
Hi Hammad

I have the same trouble, the only workaround i found is to clear binding to ItemsSource property of RadTreeView before you change collection and bind it again after.
0
Pavel Pavlov
Telerik team
answered on 11 Aug 2011, 01:22 PM
Hi guys,

Are we talking about RadTreeView or RadTreeListView ? Anyway, I believe we could be in help here in case we can obtain a small runnable repro project that exposes the issue.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Aleksey Dyomin
Top achievements
Rank 1
answered on 11 Aug 2011, 01:29 PM
Hi Pavel

I try to create solution, unfortunately i cant reproduce it. I only can attach my stack trace
в MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   в MS.Internal.XcpImports.Collection_RemoveAt[T](PresentationFrameworkCollection`1 collection, UInt32 index)
   в System.Windows.PresentationFrameworkCollection`1.RemoveAtImpl(Int32 index)
   в System.Windows.Controls.VirtualizingPanel.RemoveInternalChildRange(Int32 index, Int32 range)
   в Telerik.Windows.Controls.TreeView.TreeViewPanel.RemoveChildRange(GeneratorPosition position, Int32 itemCount, Int32 itemUICount)
   в Telerik.Windows.Controls.TreeView.TreeViewPanel.OnItemsRemove(ItemsChangedEventArgs args)
   в Telerik.Windows.Controls.TreeView.TreeViewPanel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)
   в System.Windows.Controls.VirtualizingPanel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)
   в System.Windows.Controls.VirtualizingPanel.OnItemsChangedHandler(Object sender, ItemsChangedEventArgs args)
   в System.Windows.Controls.Primitives.ItemsChangedEventHandler.Invoke(Object sender, ItemsChangedEventArgs e)
   в System.Windows.Controls.ItemContainerGenerator.RemoveItem(Object item, Int32 itemIndex, DependencyObject container, Int32 containerCount, GeneratorPosition position, ItemBlock block, Int32 offsetFromBlockStart, Boolean raiseReplaceInsteadOfRemove)
   в System.Windows.Controls.ItemContainerGenerator.OnItemRemoved(Object item, Int32 itemIndex, Boolean raiseReplaceInsteadOfRemove)
   в System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.ICollectionChangedListener.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   в System.Windows.Controls.WeakCollectionChangedListener.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   в System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   в System.Windows.Controls.ItemCollection.NotifyCollectionChanged(NotifyCollectionChangedEventArgs e)
   в System.Windows.Controls.ItemCollection.System.Windows.Controls.ICollectionChangedListener.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   в System.Windows.Controls.WeakCollectionChangedListener.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   в System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   в System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
   в System.Collections.ObjectModel.Collection`1.Remove(T item)
0
Richard
Top achievements
Rank 1
answered on 02 Apr 2012, 08:02 PM
row.IsExpanded = true will throw this error if row.IsExpandable = false
Tags
TreeView
Asked by
Hammad
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Hammad
Top achievements
Rank 1
JJ Loubser
Top achievements
Rank 1
Aleksey Dyomin
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Richard
Top achievements
Rank 1
Share this question
or