OpenFileDialog's ShowDialog method returns a nullable boolean, set to true if the user clicked OK or false if he clicked Cancel. When does it return null
? The documentation does not say.
This is stated in the questions linked below, but I'll mention here that Programming WPF (Chris Sells, Ian Griffiths) says:
ShowDialog will always return true or false. ... Only after a dialog has been shown but before it's been closed is DialogResult null.
Similar question: When would ShowDialog() return null?