- | rssFeed | My book on MSBuild and Team Build | Archives and Categories Monday, 11 February 2008

Silverlight: ErrorCode 1001

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

Silverlight | Visual Studio 2008 Monday, 11 February 2008 05:05:26 (GMT Standard Time, UTC+00:00)  #     |