0

This is my program's basic Information:

  • WPF Application
  • Target Framework: 4
  • Platform Target: Any CPU

Now when I try to open a file dialog I get a FatalExecutionEngineError.

This is my code:

Microsoft.Win32.OpenFileDialog OF = new Microsoft.Win32.OpenFileDialog();
OF.Filter = " All File (*.*)|*.*";

bool? res = OF.ShowDialog();

if (res == true)
{
// Do Some Code
}

Error Discription:

FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the error was at 0xe80fc200, on thread 0x1fbc. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Jeroen
  • 60,696
  • 40
  • 206
  • 339
M Ekramy
  • 41
  • 5

1 Answers1

0

Use the System.Windows.Forms.OpenFileDialog instead of Microsoft.Win32.OpenFileDialog.

Mike Perrenoud
  • 66,820
  • 29
  • 157
  • 232