Wednesday, March 18, 2009

WPF Designer causes Visual Studio to Close

Okay, so we all know that the WPF designer in Visual Studio 2008 is suboptimal. And if you didn't, now you know. Besides not being particularly user friendly, it's buggy as hell.

Today, while trying to demonstrate the basics of XAML / WPF, I was trying to show the design view of a WPF Window. The problem was, every time I opened the designer, the IDE would just close. No error, no beep, just gone. That was awesome.

Here are the things that I did that didn't solve the problem:
  • Cursed.
  • Rebuilt all.
  • Cleaned solution, then rebuilt all.
  • Manually cleaned the solution by deleting the bin and object folders under each project in the solution.
  • Closed the solution and deleted the .suo file (Solution Options File).
  • Closed the solution and deleted the project user files.
  • Rebooted.
  • Cursed when it still didn't work.
  • Contemplated Harakiri.
Here's what did work:
  • Deleted all of the temp files in the temp directory.
WTF? So in XP, here is the temp directory that was causing the issue (it's a different path in Vista):

C:\Documents and Settings\\Local Settings\Temp

There were like almost 5,000 files in that directory. Apparently, the designer creates temp files. My best theory is that tt will keep bogging down trying to find unique temp file names until one day it runs out of combinations. Then there is no call for help, no suicide note, it just quietly and inexplicably goes away. It doesn't even hang itself (no process remains in Task Manager).

I had discovered this fix many moons ago, and had of course forgotten about it until months later when my temp directory filled up.

No comments: