locked
First-chance exception at <addr> in <app.exe>: 0x000006BA: The RPC server is unavailable. RRS feed

  • Question

  • I'm really rusty with MFC, but I need to get back up to speed for some native code development.  My very simple program does nothing at this point except try to open a File Open Dialog when a button is pressed.  Here's the callback:
    void CGlassCatCreatorDlg::OnBnClickedbfilepicker()
    {
    	CString fileName;
    	TCHAR szFilters[] = _T ("CSV Files (*.csv)|*.csv)");
    	CFileDialog dlgFile(TRUE, _T ("csv"),
                                    _T ("*.csv"),
                                    OFN_FILEMUSTEXIST,
                                    szFilters);
    	if (dlgFile.DoModal() == IDOK) {
    		fileName = dlgFile.GetPathName();
    		// set the text in the EditBox
    		fileEdit.SetWindowText(fileName);
    	}
    }
    
    This code crashes when I call DoModal() and I get the error message in the message title.  Does anyone have any ideas as to why RPC is even in the picture?  Or, assuming that it's a spurious error message, what am I doing wrong?  (I'm using VS2008.)
    Friday, January 8, 2010 12:34 AM

Answers

  • This is something that is handled internally because of a first chance exception.
    The debugger does Structured Exception Handling by ignoring some partial failures.
    If you check the Win32 Exception, you're telling the debugger to throw exceptions for first chance exceptions.
    This is the expected behavior.

    The code will work without errors if you do not invoke the debugger by pressing Ctrl+F5.


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Wesley Yao Thursday, January 14, 2010 3:26 AM
    Sunday, January 10, 2010 2:28 PM

All replies

  • hay eck,

    try like this
    {
       CFileDialog *pFD = new CFileDialog( TRUE );
       pFD->DoModal();
      // etc.
      // etc.
      delete pFD;
    }

    code just crashes in ~CFileDialog (when dlg does out of scope and is destroyed). Since m_ofn member of CFileDialog depends on this _WIN32_WINT:

    typedef struct tagOFN {
    // ...
    #if (_WIN32_WINNT >= 0x0500)
      void *        pvReserved;
      DWORD         dwReserved;
      DWORD         FlagsEx;
    #endif // (_WIN32_WINNT >= 0x0500)
    } OPENFILENAME

    this should also work

    void CFileTestView::OnViewFile()
    {
    CFileDialog dlg(TRUE);

    #if (_WIN32_WINNT >= 0x0500)
    dlg.m_ofn.pvReserved = NULL;
    dlg.m_ofn.dwReserved = 0;
    dlg.m_ofn.FlagsEx = 0;
    #endif

    dlg.DoModal();
    }
    Thanks Mike --------Please mark as answer if it is useful----------
    Friday, January 8, 2010 8:56 AM
  • Mike,
      Thanks for the suggestions, unfortunately neither of them works.  The program still crashes in the DoModal() call with the same error message.

    But I also have some good(?) news:  If I go into the Debug | Exceptions dialog and uncheck the Win32 exceptions, the program runs fine.  I'm not happy with this solution, but at least it's a workaround for now.

    Search results show that this problem has been around since 2004.  It would be nice if it were fixed.
    Friday, January 8, 2010 9:49 PM
  • This is something that is handled internally because of a first chance exception.
    The debugger does Structured Exception Handling by ignoring some partial failures.
    If you check the Win32 Exception, you're telling the debugger to throw exceptions for first chance exceptions.
    This is the expected behavior.

    The code will work without errors if you do not invoke the debugger by pressing Ctrl+F5.


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Wesley Yao Thursday, January 14, 2010 3:26 AM
    Sunday, January 10, 2010 2:28 PM