How to Kill Visual Studio 2008 Elegantly

October 12, 2009

one comment

Here’s an elegant (in my opinion) way to kill Visual Studio 2008 immediately without leaving any trace.

Here’s what you need to do:

1. Open up VS 2008 and create a new project of type C# WPF Application.

2. Open Window1.xaml and make sure you get a split view of XAML and preview.

3. The top level layout panel is a Grid (by default). Add two rows, and in one place a button. Also name the window (e.g. “win”). The markup should be something like this:

<Window x:Class="WpfApplication3.Window1"



    Title="Window1" Height="300" Width="300" x:Name="win">



            <RowDefinition />

            <RowDefinition />


        <Button Content="Click me if you can!" FontSize="20" />



You should see the button filling the first row of the grid. Now for the fun part:

Add a Rectangle to the second row of the grid and set its fill property to use a VisualBrush binded to the window itself. Should be something like:

<Rectangle Grid.Row="1">


     <VisualBrush Visual=“{Binding ElementName=win}" />



As soon as you close that tag on the VisualBrush – BAM! VS disappears…

What happened here?

The VisualBrush used the window to paint the rectangle, but that means the window has changed again, so the rectangle needs to repaint and so on and so forth… I guess the poor WPF designer just couldn’t handle it…

And some people say WPF is not fun…

For all you debuggers out there, you’ve got a classic case of adplus –crash and a good dump debugging with WinDbg. Enjoy!


Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


one comment

  1. Liran ChenOctober 12, 2009 ב 23:13

    This just shows how at the end of the day, we’re all just a bunch of QA for Microsoft 🙂