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=""> <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! :D

    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. forgetuMarch 13, 2009 ב 9:43

    Thanks.

    Reply
  14. Scott MarloweMarch 23, 2009 ב 17:05

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

    Reply
  15. JonasApril 9, 2009 ב 2:44

    Thank you! This was a life saver :)

    Reply
  16. Ken SmithApril 16, 2009 ב 3:10

    Ah, very helpful. Many thanks.

    Reply
  17. davidApril 18, 2009 ב 5:01

    Exactly my problem… you saved me!

    Reply
  18. Bryan SumterApril 23, 2009 ב 11:14

    You’re the best! :)

    Reply
  19. IrfanApril 23, 2009 ב 14:47

    Thanks it worked for me :)

    Reply
  20. Alex GoleshApril 23, 2009 ב 20:05

    David, Brayan, Irfan, Jonas, Ken & others: Welcome! :)

    Reply
  21. HasanMay 6, 2009 ב 21:40

    Thank you so much for posting this.

    Reply
  22. MatthewMay 27, 2009 ב 3:19

    This is a great post, succinct and to the point! Saved what shreds of sanity I have left :)

    Reply
  23. DanJune 16, 2009 ב 18:50

    Great post, it helped me out just now.

    Reply
  24. John CarrJune 26, 2009 ב 20:30

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

    Reply
  25. 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
  26. 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
  27. firasAugust 5, 2009 ב 15:37

    Thanks, saved me an hour :)

    Reply
  28. kalyanAugust 12, 2009 ב 3:01

    Thanks this solved my issue, saved couple of hours.

    Reply
  29. Matthew McDermottSeptember 2, 2009 ב 15:32

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

    Reply
  30. heliosSeptember 30, 2009 ב 14:23

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

    Reply
  31. ChrisNovember 11, 2009 ב 6:59

    Thanks for the tip!

    Reply
  32. 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
  33. NeznajjkaDecember 27, 2009 ב 1:07

    Alex, Thanks!

    Reply
  34. JeremyJanuary 14, 2010 ב 19:38

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

    Reply
  35. TuxeyMarch 12, 2010 ב 22:40

    U da man!! Totally solved my problem! Thx

    Reply
  36. DevMarch 24, 2010 ב 7:57

    Thanks a lotttttttttt

    Reply
  37. Me@AnnonymousApril 6, 2010 ב 17:44

    Thanks much, time and energy saver

    Reply
  38. 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
  39. undefindApril 20, 2010 ב 9:24

    thank you!

    Reply
  40. SLUserJune 21, 2010 ב 13:24

    Thanks for your post. You saved my time

    Reply
  41. SuzJune 22, 2010 ב 9:13

    Thank you!!!!

    Reply
  42. 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
  43. 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
  44. 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
  45. davisAugust 18, 2010 ב 10:40

    Helps a lot… Thank you very much!

    Reply
  46. thankingSeptember 22, 2010 ב 1:39

    Thank you!

    Reply
  47. BirgenOctober 3, 2010 ב 18:18

    Thanks, you have saved me some hours!

    Reply
  48. 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
  49. Doug WileyOctober 15, 2010 ב 23:23

    OMG thank you so much.

    Reply
  50. RaghavendraNovember 16, 2010 ב 12:57

    Thanks for the info.

    Reply
  51. DanDecember 17, 2010 ב 6:38

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

    Reply
  52. 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
  53. 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
  54. LouieMay 20, 2011 ב 2:36

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

    Reply
  55. Bill FJune 2, 2011 ב 20:32

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

    Reply
  56. 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
  57. RaTTAugust 24, 2011 ב 12:30

    Thanks a lot. It made my day)

    Reply
  58. RahulSeptember 5, 2011 ב 16:25

    Thanks a lot :-)

    Reply
  59. GeneNovember 20, 2011 ב 1:36

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

    Reply
  60. AlexDecember 4, 2011 ב 23:57

    Thank you! You helped me a lot!

    Reply
  61. confusedJanuary 30, 2012 ב 14:31

    i didnt changed the namespace and the error accours..

    What now?

    Reply
  62. HoudiniJuly 3, 2012 ב 18:14

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

    Reply
  63. 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