Just In Time Debugger (JIT) Error When Debugging Silverlight in Visual Studio Causing White Screen Of Death

Silverlight have a nasty habit of calling just in time debugger (JIT) when its throwing unhandled exception. This will; in turn; throw the infamous white screen of death when you close the VS’s JIT window. It’s really REALLY annoying. I’ve tried disabling script debugging in IE and JIT in VS to no avail.

I found that the only way to disable this behavior is by catching all unhandled exception in App.xaml.cs as follow:

  public App()
        {
            InitializeComponent();

            this.UnhandledException += new EventHandler<ApplicationUnhandledExceptionEventArgs>(App_UnhandledException);
        }

  void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.ExceptionObject.Message);
            e.Handled = true;
        }

EXTRA TIP: Go to Debug-Exception in Visual Stuidio and tick Thrown in CLR exception for even more thorough debugging.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: