Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Silverlight

Solving Silverlight error : Unexpected NONE in parse rule ElementBody

5.00/5 (2 votes)
15 Oct 2011CPOL 20.6K  
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)