Click here to Skip to main content
15,888,070 members
Articles / Silverlight
Tip/Trick

Solving Silverlight error : Unexpected NONE in parse rule ElementBody

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
15 Oct 2011CPOL 20.1K   1   3
Silverlight XAML parsing error
Are you facing the following error while compiling Silverlight code?

"Unexpected NONE in parse rule ElementBody ::= ATTRIBUTE* ( PropertyElement | Content )* . ENDTAG.."

Please check your XAML, it must be containing syntax like:
XML
<UserControl.Resources />

OR:
XML
<Grid.ColumnDefinitions />

OR:
XML
<ListBox>
     <ListBox.Items/>
</ListBox>

For unknown reasons, Silverlight compiler fails if you have declared something similar to these. Reason I could guess is Silverlight compiler fails to compile empty collection syntax declared in the aforementioned way.

It though supports empty collections if declared as below:
XML
<UserControl.Resources > </UserControl.Resources >

OR:
XML
<Grid.ColumnDefinitions > </Grid.ColumnDefinitions >

OR:
XML
<ListBox>
    <ListBox.Items></ListBox.Items>
</ListBox>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionBEST TIP EVER dude.... Pin
tjhackz24-Aug-12 21:28
professionaltjhackz24-Aug-12 21:28 
GeneralThough he doesn't say it, the Grids seem to be succeptible t... Pin
OmegaMan2-Feb-12 10:34
OmegaMan2-Feb-12 10:34 
GeneralReason for my vote of 5 Nice tip, might save some hair pulli... Pin
Julien Villers17-Oct-11 22:33
professionalJulien Villers17-Oct-11 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.