Fix error "System.InvalidCastException [A]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox cannot be cast to [B]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox"
As a result of experiments with WPF controls I got the error in Visual Studio 2013. I started to look for records in block "using", but it was all right there.
Full text of error is:
System.InvalidCastException
[A]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox cannot be cast to [B]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox. Type A originates from 'Microsoft.Expression.Utility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'LoadFrom' at location 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\microsoft.expression.utility.dll'. Type B originates from 'Microsoft.Expression.Utility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.Expression.Utility.dll'.
Solution
According to logs, the reason is in Microsoft.Expression.Utility.dll. To fix the problem you should just to delete it from references and save project (Figure 2).
Don't forget to remove text from XAML and CS files referenced to this dll.