Just a quick one for reference (although it took me a bit to figure out)…

I was upgrading my application from Silverlight 2 to Silverlight 3 I must have tidied up my Xaml and introduced a compilation error. Both Visual Studio 2008 and Blend3 did not pick it up at design time – much to my frustration!


Compiling my Silverlight application prompted the following error.

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

Double clicking the error in took me to my Xaml, but positioned itself within the
Grid x:Name=LayoutRoot element as seen below.

Bad example

Digging about by removing attributes or redefining the element did not produce any resolution, especially since the error states that there are no attributes when clearly there are!


The broken compilation rule actually does make sense, if you consider the line before where Visual Studio thinks there is a problem. Taking a look at the closed

UserControl.Resources element it became apparent that the compiler expects this to be an open element (even if it remains empty) if it has been declared.

Good example

So, either declare the UserControl.Resources element as an open, empty tag, or fill it with some resources, or just remove it!


This is a cross post from my EMC blog, mainly for backup duplicity and to aggregate some of my past postings. My EMC blog used to be under the Conchango brand but was acquired by EMC so I’ve also retrospectively refreshed some of the old links too.
permalink to the original post here