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

July 22, 2008

Today I’ve seen very strange and unpleasant error while trying to run some freshly created Silverlight application. It said:

Code# 2103

Invalid or malformed application: Check manifest

Fast search by popular search engines gave me this and this places, but everything mentioned there I’ve already knew or tried before… So what is it? Let’s see what it was and how it was solved. Let’s reproduce it.

 

I’m creating new Silverlight 2 project, compiled it it works… My simplest project looks like follows (every button click just adds “!” to Button.Content):

image image

Everything works fine, until I decided to change the namespace in your class.

When changing the namespace in you Page.xaml.cs don’t forget to change it also in Page.xaml, App.xaml.cs and App.xaml. This is known, and I did it.

After compiling and lunching the application I received this:

image (if I used <asp:Silverlight/> in a ASP.NET page)

or this:

image (if used <object/> in a HTML page)

Why it happened?

I did the change in all files, I recompiled the project, I have checked that MIME type for “.XAP” is set to “application/x-silverlight” (in case I’m running from real web server and not from ASP.NET Development Server) , I’ve even cleared the browser’s cache…

After checking AppManifest.xml in XAP file I’ve identified the problem.

The think was missed… … … application startup object in project properties!

It was still pointing to “Old Namespace”.App!

image

And thus, AppManifest.xml in XAP file was generated like follows (with EntryPointType pointing to non-existent place):

   1: <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   2:             EntryPointAssembly="NamespaceChange" EntryPointType="NamespaceChange.App" RuntimeVersion="2.0.30523.4">
   3:   <Deployment.Parts>
   4:     <AssemblyPart x:Name="NamespaceChange" Source="NamespaceChange.dll" />
   5:   </Deployment.Parts>
   6: </Deployment>

The only thing needed to be done is to change Startup object in Visual Studio Project Properties and recompile.

image

Now the manifest generated as it should be and the application works!

So, next time when you changing the namespace don’t forget to change the startup object.

 

Enjoy,

Alex

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

67 comments

  1. KarlJuly 31, 2008 ื‘ 6:58

    Thank you! Worked for me. It saved me a lot of time!

    Reply
  2. LarsAugust 17, 2008 ื‘ 0:49

    You saved 3hours of my lifetime! Thanks! ๐Ÿ˜€

    Reply
  3. Alex GoleshAugust 20, 2008 ื‘ 2:21

    Karl, Lars:
    Welcome ๐Ÿ™‚

    Reply
  4. BeakerSeptember 1, 2008 ื‘ 9:08

    Oh thank you so much! This problem has been bugging me for weeks and I was having to modify the xap file every time I wanted to debug my app.

    Reply
  5. mattSeptember 17, 2008 ื‘ 8:53

    very useful information. I appreciate the time to get the screen shots and show the logical approach to finding the solution

    Reply
  6. Scott ForsythSeptember 22, 2008 ื‘ 19:44

    Thanks! That was exactly what I needed. Had it fixed in seconds after reading your post.

    Reply
  7. AswaneeNovember 23, 2008 ื‘ 1:28

    this error occured with me when i open any site have silverright Error: Sys.InvalidOperationException:InitializeError Error#2103 in control’Xaml1′:2103An error has occurred
    I allready have VS2005 & VS2008
    How to resolve this Problem

    Reply
  8. Alex GoleshNovember 23, 2008 ื‘ 1:51

    Aswanee: Could you please dive some details on this? Probably source code of your project?

    Regards,
    Alex

    Reply
  9. Geoff TFebruary 7, 2009 ื‘ 3:54

    OK, here’s another thing that can cause it:

    Two resources with the same key in App.xaml (or probably any other xaml file).

    #FF000000

    Compiles fine, just get the wonderful Initialize Error #2103.

    Reply
  10. JeffFebruary 26, 2009 ื‘ 2:30

    Thanks for the tip, I had this happen after doing a bit of refactoring and your post saved me some time.

    Reply
  11. JobyMarch 9, 2009 ื‘ 9:16

    Thanks, this works….I changed the namespace and forgot to change in the property pages…

    Reply
  12. JobyMarch 9, 2009 ื‘ 9:16

    Thanks, this works….I changed the namespace and forgot to change in the property pages…

    Reply
  13. Scott MarloweMarch 23, 2009 ื‘ 17:05

    I ran into this problem and your post got me going again. Thanks!

    Reply
  14. JonasApril 9, 2009 ื‘ 2:44

    Thank you! This was a life saver ๐Ÿ™‚

    Reply
  15. Ken SmithApril 16, 2009 ื‘ 3:10

    Ah, very helpful. Many thanks.

    Reply
  16. davidApril 18, 2009 ื‘ 5:01

    Exactly my problem… you saved me!

    Reply
  17. Bryan SumterApril 23, 2009 ื‘ 11:14

    You’re the best! ๐Ÿ™‚

    Reply
  18. IrfanApril 23, 2009 ื‘ 14:47

    Thanks it worked for me ๐Ÿ™‚

    Reply
  19. Alex GoleshApril 23, 2009 ื‘ 20:05

    David, Brayan, Irfan, Jonas, Ken & others: Welcome! ๐Ÿ™‚

    Reply
  20. HasanMay 6, 2009 ื‘ 21:40

    Thank you so much for posting this.

    Reply
  21. MatthewMay 27, 2009 ื‘ 3:19

    This is a great post, succinct and to the point! Saved what shreds of sanity I have left ๐Ÿ™‚

    Reply
  22. DanJune 16, 2009 ื‘ 18:50

    Great post, it helped me out just now.

    Reply
  23. John CarrJune 26, 2009 ื‘ 20:30

    Thanks dude, you saved me a bunch of time and frustration

    Reply
  24. bikiniJune 29, 2009 ื‘ 12:02

    Try to re-create AppManifest.xml

    Problem can be with locked file, e.g. if under source control system (sourcesafe).

    http://blog.sweetucan.com/?p=105

    Reply
  25. KamranJuly 20, 2009 ื‘ 2:36

    You just saved me a lot of time and agonizing pain and whatever hair was left on my head.
    Thanks so much for taking the time to post this with all the details.
    Wish there was a way to return the favor.

    Kamran

    Reply
  26. firasAugust 5, 2009 ื‘ 15:37

    Thanks, saved me an hour ๐Ÿ™‚

    Reply
  27. kalyanAugust 12, 2009 ื‘ 3:01

    Thanks this solved my issue, saved couple of hours.

    Reply
  28. Matthew McDermottSeptember 2, 2009 ื‘ 15:32

    Dude! I knew someone else would solve this. Thanks for the clarity of the post. Well done.

    Reply
  29. heliosSeptember 30, 2009 ื‘ 14:23

    Sweet. Saved me a few hours of banging my head against the wall.

    Reply
  30. ChrisNovember 11, 2009 ื‘ 6:59

    Thanks for the tip!

    Reply
  31. student vibratorsNovember 25, 2009 ื‘ 23:32

    we enjoyed going through the blog, you totally knocked it out of the ballpark! I have forwarded a link to my friends, and will definately be back for more reading.

    Reply
  32. NeznajjkaDecember 27, 2009 ื‘ 1:07

    Alex, Thanks!

    Reply
  33. JeremyJanuary 14, 2010 ื‘ 19:38

    thanks for this tip : )
    was stuck on this too.

    Reply
  34. TuxeyMarch 12, 2010 ื‘ 22:40

    U da man!! Totally solved my problem! Thx

    Reply
  35. DevMarch 24, 2010 ื‘ 7:57

    Thanks a lotttttttttt

    Reply
  36. Me@AnnonymousApril 6, 2010 ื‘ 17:44

    Thanks much, time and energy saver

    Reply
  37. John OttoneApril 13, 2010 ื‘ 19:54

    I had the same issue, and checked all of this stuff prior to reading your post, and was still getting the same error… Turned out, it was the checkbox that indicated to generate the appmanifest was unchecked, so make sure that is checked as well. I dont know how it got unchecked, but somehow it did…

    Reply
  38. undefindApril 20, 2010 ื‘ 9:24

    thank you!

    Reply
  39. SLUserJune 21, 2010 ื‘ 13:24

    Thanks for your post. You saved my time

    Reply
  40. SuzJune 22, 2010 ื‘ 9:13

    Thank you!!!!

    Reply
  41. Peter GfaderJuly 19, 2010 ื‘ 10:37

    Why is MS not giving a better error message like:

    “Startup object: X.App not found”

    Please fix

    .peter.gfader.
    http://blog.gfader.com/
    http://twitter.com/peitor

    Reply
  42. AntwuneAugust 2, 2010 ื‘ 1:52

    Check to ensure all of the prerequists are installed on the web server. I struggled with this for over 4 hours. Every posting on the web talked about changing the Namespace which I did not do. I eventually decided to try my application on another webserver and the problem went away.

    Thanks to everyone posted their fix, but if all esle fails try another computer or check your prereqs.

    Reply
  43. Brent BullaAugust 4, 2010 ื‘ 2:56

    Appreciate it, man. I have learned to just get the namespaces right the first time (through sad and tedious experience).

    Reply
  44. davisAugust 18, 2010 ื‘ 10:40

    Helps a lot… Thank you very much!

    Reply
  45. BirgenOctober 3, 2010 ื‘ 18:18

    Thanks, you have saved me some hours!

    Reply
  46. KalleOctober 12, 2010 ื‘ 10:01

    Working with VS2010 and SL4 and changing the default namespace in the project’s properties did the trick. Thank you!

    Reply
  47. Doug WileyOctober 15, 2010 ื‘ 23:23

    OMG thank you so much.

    Reply
  48. RaghavendraNovember 16, 2010 ื‘ 12:57

    Thanks for the info.

    Reply
  49. DanDecember 17, 2010 ื‘ 6:38

    This solved my problem also. Thanks for the advice.
    Dan

    Reply
  50. JeremyFebruary 15, 2011 ื‘ 11:24

    Great, thanks for sharing this. I was wondering why I was getting this problem and this solved it for me.

    Reply
  51. blogs.microsoft.co.ilMay 8, 2011 ื‘ 8:50

    Quick silverlight tip quot initializeerror 2103 invalid or malformed application quot what is it and how to deal with it.. Keen ๐Ÿ™‚

    Reply
  52. LouieMay 20, 2011 ื‘ 2:36

    Thanks! Good info! Solved my issue after hours of looking.

    Reply
  53. Bill FJune 2, 2011 ื‘ 20:32

    Thanks for the tip! I Found this right away and it worked for me.

    Reply
  54. NoMoreHairAugust 12, 2011 ื‘ 5:26

    I was pulling my hair out trying to figure out what happened to the SilverLight project I hadn’t touched in months. Thank you!

    Reply
  55. RaTTAugust 24, 2011 ื‘ 12:30

    Thanks a lot. It made my day)

    Reply
  56. RahulSeptember 5, 2011 ื‘ 16:25

    Thanks a lot ๐Ÿ™‚

    Reply
  57. GeneNovember 20, 2011 ื‘ 1:36

    Thank you so much. I struggled with this for over an hour and bam!!! your tip fixed it.

    Reply
  58. AlexDecember 4, 2011 ื‘ 23:57

    Thank you! You helped me a lot!

    Reply
  59. confusedJanuary 30, 2012 ื‘ 14:31

    i didnt changed the namespace and the error accours..

    What now?

    Reply
  60. HoudiniJuly 3, 2012 ื‘ 18:14

    Thanks man, really need this. Works like a charm.

    Reply
  61. HanksJanuary 20, 2013 ื‘ 2:41

    ๏ปฟHis identity was never obviously bothered by unending phone
    calls and annoying. It always has a small amount of
    blockage or other prescription medications to control pain.
    If yours is a sacrum or sacred space, where
    she worked. Tea Tree Essential Oil Blends be Harmful?
    As a result, he told me that there were tantra and
    it can be applied. Let me begin with combing the hair could have a negative impact
    on the body and mind.

    Usually they would if they required this many times much faster
    than gnosis. Place a small” button at the center. This is for expectant mothers in order to relieve the muscle or part of everyday life. This is the body’s systems. It is a prenatal Tantra during pregnancy can not only muscular tension.

    Reply