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

后端 未结 25 1019
情书的邮戳
情书的邮戳 2020-12-24 05:01

In Silverlight 4 app; what does this error mean?:

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

It

相关标签:
25条回答
  • 2020-12-24 05:45

    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.

    0 讨论(0)
  • 2020-12-24 05:45

    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.

    0 讨论(0)
  • 2020-12-24 05:47

    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...

    0 讨论(0)
  • 2020-12-24 05:48

    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.

    0 讨论(0)
  • 2020-12-24 05:51

    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.

    0 讨论(0)
  • 2020-12-24 05:52

    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.

    0 讨论(0)
提交回复
热议问题