Tuesday, October 23, 2012

Fixed My Silverlight 2103 error

I was going through EVERY post I could find on how to fix the dreaded Silverlight 2301, white screen of death, shows nothing error.

I had the namespace right in the properties, my App.xaml and App.xaml.cs were right, my AppManifest was right. I FINALLY found my answer in one of the comments after the post

In Alex's blog, he posts the answer with the namespace and matching startup object (like I mentioned I had tried this many times. Even tried changing to the wrong one and then back to the right one. The monitor almost went flying, but there were witnesses) But one of the comments left on his blog was exactly what I needed, and worked like a charm!

  re: Quick Silverlight Tip: "InitializeError #2103 - Invalid or malformed application" what is it and how to deal with it?

OK, here's another thing that can cause it:
Two resources with the same key in App.xaml (or probably any other xaml file).
<Color x:Key="DefaultTextForeground>#FF000000</Color>
<Color x:Key="DefaultTextForeground>#FF000000</Color>
Compiles fine, just get the wonderful Initialize Error #2103.
 Thank you VERY much Mr. Geoff T (that part didn't copy over on here) but you definitely solved my problem and saved my hairline.

So, for me the solutions have been:

1. Check on the properties to make sure the namespaces match up to the solution (Alex describes this well in his blog)
2. Make sure that your XAML styles don't have any repeat names. Mine compiled because the duplicate names were in different resource files (oops). I checked on the new ones I added and searched to see if I had already named a style or color the same name. 

I had the error again, and went through the steps above (again). Of course I found one name duplicated - but it still gave me the error when I tried to Debug.

I ran across this post and decided to try it. Basically, all I did was go into the properties - change to something else and then change it BACK to the setting it was supposed to be. 

For some unknown reason - it actually worked.