Recently I ran into an error when creating a simple Silverlight, Silverfish as I like to call it. The error was in occurring in the constructor of the Silverlight control that I created. Specifically it occurred when the content was read from the resource with the following statement
this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd());
Once this was executed an Exception was thrown with the following message
Error HRESULT E_FAIL has been returned from a call to a COM component.
And the dialog shown below was displayed
I Googled this error for a bit and it seemed like there were various errors that could cause this. So I started playing with the XAML that it was attempting to load. I discovered that the issue was caused by an Element with the same Name attribute as a previously declared one. So if you get this error make sure that all your Elements have unique names attached to them.
Sayed Ibrahim Hashimi
Comments are closed.