4

I'm getting an error when I try to use the SaveFileDialogue in a WinForms app. I must be missing something as the error makes no sense (to me!)!

The error is: "First-chance exception at 0x000007fefc99cacd in TestProject.exe: 0x000006BA: The RPC server is unavailable."

The error occurs when this line runs: "if (SD.ShowDialog() == DialogResult.OK)".

Here is my code:

var SD = new SaveFileDialog();
SD.Filter = "PDF (*.pdf)|*.pdf|Show All Files (*.*)|*.*";
SD.FileName = "Untitled";
SD.Title = "Save As";
if (SD.ShowDialog() == DialogResult.OK)
{
// DO SOMETHING HERE
}

Edit: I'm saving the file locally, but the error occurs before the user has even picked a location to save, it occurs at the point where I try to show the dialogue for the user to pick the location!

Faraday
  • 2,904
  • 3
  • 23
  • 46

1 Answers1

3

Probably you have activated some flag in the Exceptions Debug Menu.
Try to reset to default configuration going to Debug -> Exceptions -> Reset All

Steve
  • 213,761
  • 22
  • 232
  • 286
  • 2
    I have activated the flag to break on all exceptions (caught and uncaught), but my question is really, why is there an exception and how do I stop it? I don't want to simply ignore the fact that it's there! :) – Faraday Jun 04 '12 at 21:58
  • 1
    It is an exception caught inside the SaveFileDialog and your code has nothing to worry about. If you try your application in release mode you don't have any exception. Right? [Some background here](http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx) – Steve Jun 04 '12 at 22:02
  • OK, I'm willing to admit that I might have been a bit too proactive on this one, if... You can point me to something which explains why the SaveFileDialogue has an exception? It seems unlikely that a basic control which hasn't been modified for donkeys has an exception in it! :-S Surely MS know better than this ;-) – Faraday Jun 04 '12 at 22:17
  • 1
    And, how the hell to I get more points on here? I'm just trying to get to 200 points, but I'm dying down here at 30! – Faraday Jun 04 '12 at 22:18
  • The only way is: Post questions, accept answers, post (right) answers to other users questions, help the community with edits, take your time to read the [FAQ](http://stackoverflow.com/faq) – Steve Jun 04 '12 at 22:25
  • I'm getting the same error but for me happens in debug and also in release... any more clues? – Osk May 15 '13 at 12:29