CFileDialog posts "First-chance exception" in debugger window

1

My Windows application employs the following piece of C++/MFC code that is used to open a file:

CFileDialog fd(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, 
    NULL, hParentWnd ? CWnd::FromHandle(hParentWnd) : NULL);

fd.m_pOFN->Flags &= ~(OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_NODEREFERENCELINKS);
fd.m_pOFN->Flags |= OFN_FILEMUSTEXIST;

INT_PTR nRes = fd.DoModal();    //This call causes the warning

It runs fine but I get the following message in the debugger output window in VS 2008:

First-chance exception at 0x00007ffb653d5bf8 in MyApp.exe: 0x000006BA: The RPC server is unavailable.

Is it something that I need to be concerned about?

c++
windows
winapi
mfc
fileopendialog
asked on Stack Overflow Jul 19, 2014 by c00000fd

1 Answer

1

The reasons breaking on first-chance exceptions can be useful are:

  • the exception at first glance seems handled, but really isn't. (Your application does have an exception handler, but it ends up rethrowing the exception.)
  • the exception appears handled to the debugger, but really isn't. (Your application does have an exception handler, but it just logs the exception and aborts the program. Similar to the above.)
  • the exception is handled, but points to a deeper problem that should be fixed.

The reasons breaking on first-chance exceptions can be useless are:

  • the exception is handled, and does not point to anything you should worry about.
  • the exception is handled, and does point to a real issue, but one that cannot be fixed, only handled.

The debugger cannot know which of these applies, that's your job as a developer. Based on the information in the question, I would guess that this is the fourth bullet point, meaning you're better off not having the debugger break when that type of exception is thrown.

In general, if you only get a first-chance exception message, but everything works fine, it's probably nothing to worry about. It means there was an exception, but the exception was caught and seemingly handled correctly.

answered on Stack Overflow Jul 19, 2014 by (unknown user)

User contributions licensed under CC BY-SA 3.0