I have been searching up and down the web and unfortunately never came across an issue quite like mine, so here goes:
My C# WPF application won\'t show me no OpenFil
This happened to me recently. The problem was the Main method wasn't marked as an STAThread which will cause the WPF OpenFileDialog's ShowDialog method to block indefinitely.
static void Main(string[] args)
{
var openFileDialog = new OpenFileDialog();
var result = openFileDialog.ShowDialog();
}
will never exit or throw an exception, whereas
[STAThread]
static void Main(string[] args)
{
var openFileDialog = new OpenFileDialog();
var result = openFileDialog.ShowDialog();
}
will work as expected.