Finding the source of the NullReferenceException in the ShowDialog () method
It's in WPF (C #).
I am trying to find which object is throwing a NullReferenceException when I call the ShowDialog () method on a Window object. The code is similar to this:
MyWindow myWindow = new MyWindow();
//Some properties of myWindows are set here
try
{
myWindow.ShowDialog();
}
catch (Exception) //In here I catch a NullReferenceException
{
}
Is there a way to find the reason for the exception? I put a breakpoint at the very beginning of the Window_Loaded event handler in the MyWindow class, but it just doesn't fire.
+3
source to share