0
votes

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.

1
You'll need to get your machine stable again. stackoverflow.com/a/6718336/17034Hans Passant

1 Answers

0
votes

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