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

pencilslate picture pencilslate · Nov 18, 2010 · Viewed 70.5k times · Source

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

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

It's a very generic error. The VS debugger doesn't point to the exact location of the error when debugging.

Answer

Rachel picture Rachel · Dec 10, 2011

This is kind of an old question, but I figured I'd give my answer since I found this thread by Googling for the exact same problem.

In my case, I'd copied some sample XAML from the web to get started with Silverlight Toolkit 4. That sample XAML contained a simple button with a click event handler that didn't relate to any handler that actually existed in my code behind. I didn't notice this simple problem at first, because the compiler didn't give me an error message, I just saw the "Error HRESULT E_FAIL has been returned from a call to a COM component" message above at runtime. It was only when I isolated my sample XAML by copying it into a brand new Silverlight application without any other content that the real underlying problem was revealed at compile-time.

So, if you've got the same error message at runtime, my advice is to check your XAML carefully for any errors that you had expected should have been picked up at compile time, but which for some reason ended up as the runtime error noted above. In order to debug, you can do what I did and isolate the code that's causing the error in a standalone Silverlight app with no other content, and see if like me you get a more helpful error message to guide you.

HTH.