Silverlight System.ExecutionEngineException

Just a quick note that will hopefully save someone the pain that I just went through chasing yet another exception in Silverlight with nothing to go on from Visual Studio. (I really hope that there is some better feedback coming on Silverlight applications when you hit a runtime error in the future).  Anyway, I was digging in my App.xaml today to do a bit of much-needed clean up and then started getting System.ExecutionEngineException being thrown at runtime.  I was just about to the point of pulling out WinDbg (see this post on that) and I decided that maybe Blend could help me out.  After all, it really does owe me one for all the times it wouldn’t load my xaml without telling me why.

So, I opened the project in Blend and sure enough, it gave me the old "Invalid XAML" message that I was expecting when I attempted to open my app.xaml.  However, it also gave me a bunch of errors about not finding properties from one of my styles. I took a wild shot and clicked the View XAML Code link that Blend offered.  It placed me on a style that I had added earlier and I immediately noticed that I had left off the TargetType attribute.  Adding this cured the problem.

And for those that just scan for the code…


  1. <Style x:Key="MyButtonStyle">
  2.     <Setter Property="FontSize" Value="10" />
  3. </Style>


  1. <Style x:Key="MyButtonStyle" TargetType="Button">
  2.     <Setter Property="FontSize" Value="10" />
  3. </Style>

This entry was posted in Silverlight, Silverlight 2. Bookmark the permalink.

Comments are closed.