Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear Expression Blend 4 cached solution information?

I seem to be adept at making Expression Blend 4 crash at startup. The problem seems to be related to a deadlock initializing static managed and unmanaged variables as Blend first opens my solultion which has a mixture of unmanaged C++ and managed code projects. Blend crashes instantiating my ViewModel (I'm using MVVM Light in App.xaml, but I would think this isn't really relevant). This page describes in detail how to detect and correct this potential deadlock: Initialization of Mixed Assemblies

Since I'm writing code and markup in both VS2010 and Blend4 simultaneously, I sometimes accidentally create this situation, and thereafter Blend crashes when loading my solution. The Blend startup crash persists even if I correct the issue in VS2010 (VS2010 seems immune to crashing on the same solution file which brings down Blend). The Blend startup crash can happen on both x86 and x64 systems. The Blend startup crash persists even if I try to delete all output directories. The Blend startup crash persists even if I rename "C:\Users\username\AppData\Local\Microsoft\Expression\Blend".

My question is: How do I reset Blend to a state as though it has never seen this solution before?

I'm assuming this would be a valid workaround, since if I download a new, fresh copy of my source code from source control with the managed/unmanaged problem fixed, it loads in Blend4, builds, and runs just fine.

like image 911
Jay Borseth Avatar asked Feb 07 '26 02:02

Jay Borseth


1 Answers

The main reason why Blend crashes is because when Intialising UI components it actually runs their constructor which can have some code for example accesses database and Blend doesn't support DB access so it might crash.

So there are two ways to find a potential problem.

Comments out all the code in the constructor of your UI ellements apart from InitializeComponent() to find out problematic code

Or

Attach Visual Studio Debugger to Blend and then rebuild the project or open XAML file which craheshes blend

To do 2nd option you would go to Debugger -> attach to process -> pick Blend from the list.

When you identify the code which crashes Expression Blend just have an if statement which will stop running the code if it's the blend who tries to execute it and if it is not just run it. So something like this:

if(DesignerProperties.IsInDesignModeProperty)
{
  // This code will run when Blend renders the controls
}
else
{
  // This code will run when you are running application on it's own
}

Hope this helps.

like image 64
Vitalij Avatar answered Feb 12 '26 06:02

Vitalij



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!