In Silverlight 4 app; what does this error mean?:
\"Error HRESULT E_FAIL has been returned from a call to a COM component.\"
It
I had this error using the current SL4 Telerik controls. A similar issue has been reported here with a solution ... of sorts. The problem seems to be with the way Expression Blend manages the cache of controls.
I fixed this error by deleting the XAML file and add a new one from add new item. Then I pasted the XAML codes that was there in the old file.
Well, I was almost going to eat my computer.. At last, I find out the problem is that I MAYBE BY ACCIDENT removed one parameter of one Margin setting of an Image object in the XAML page, orz..
Margin="0,-20,0"
which should be
Margin="0,-20,0,0"
Obviously I didn't realized I have ever modified anything of the XAML, so I have been troubleshooting the code behind for "a little while"..
Fortunately, I found this post and rechecked everything include the XAML page.. that was ... something...
In my situation:
I create a
class MyControl : ContentControl {
}
By default, the class is not public and XAML cannot load it and throw exception
Error HRESULT E_FAIL has been returned from a call to a COM component
Just change the scope of class to public and error disappear.
Hope this help.
PS. Microsoft should provide more on information than just throw a mystery error message without any stack trace.
For me, I narrowed it down to a SplitButton control that I downloaded off CodePlex ages ago. I had upgraded the solution from Silverlight 4 to Silverlight 5 and got slammed with this error. I was able to narrow it down by commenting out the XAML to all controls then uncommented it back in one by one until the error appreared again:
System.Reflection.TargetInvocationException was unhandled by user code Message=Exception has been thrown by the target of an invocation. StackTrace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at Homexaml_3.BindingOperation(Object BindingState, Int32 , Action ) 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.UIElement_Measure(UIElement element, Size availableSize) at System.Windows.UIElement.Measure(Size availableSize)
What fixed it was manually removing the outdated references System.Windows.Control and System.Windows.Controls.Toolkit then re-added them from the Silverlight 5 SDK folder.
Hope it helps someone (and helps me!) if it happens again a few months down the road.
I had this exception and went nuts. I would advice you check if you had recently installed a component that had possible conflicting namespace items. In my case I installed the windows phone tool-kit which had items that were similarly named with the stock tool kit on windows phone. Asap I uninstalled this from the Nuget package manager, all was back to normal.