XAML Syntax Tightening: Order Matters

In recently porting some code to Beta 2 of WPF, I hit one of the XAML Syntax Tightening changes that Tim referred to in his post on Breaking Changes in Beta 2. Basically, order matters as far as referencing resources.  If you try to reference a resource in XAML, like a style or control template, before it has been declared, you will get an error at runtime. For example, you can't do this

<Style x:Key="myStyle" BasedOn="myBaseStyle"/>
<Style x:Key="myBaseStyle" />

Fortunately, the fix is easy.  In the case above, just make sure myBaseStyle comes before myStyle.  Of course if you have 200 different resources all that are interdependent and were added adhoc in a speedy dev cycle, it can take awhile.