WELCOME

This blog is where I post about my consulting work with Microsoft Technologies, and other random tidbits that don't fit in my Photo Blog or my Iraq Blog.

Monday, July 5, 2010

Repo: fullscreen bug in Silverlight 4 crashes browser in 4 mouse clicks

This app is a demonstration of a bug in Silverlight 4 that will crash your browser in about 4 mouse clicks.

Instructions: Click the "Full Screen Toogle" button and close the resulting messagebox a few times and then... poof!  (you might want to bookmark the page first :-)





Here is the code to reproduce the bug:




    
        


using System.Windows;
using System.Windows.Controls;

namespace Silverlight.Fullscreen.Bug
{
    public partial class MainPage : UserControl
    {
        private bool firstClick = true;

        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (firstClick)
            {
                //this firstclick logic is just a convienence so that you don't get a message box the first time the page opens
                //it is NOT need to reproduce the bug...
                image1.SizeChanged += Image_SizeChanged;
                firstClick = false;
            }

            Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
        }

        private void Image_SizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
        {
            MessageBox.Show("Image_SizeChanged");
        }
    }
}

UPDATE: This bug appears to be Windows specific. I can't reproduce it on a Mac...

No comments: