0

Sample project:

https://www.dropbox.com/s/ezwe48gpezrr19u/MFCApplicationDB.zip?dl=0

I am using VS 2022. Has basic code in the dialogs OnInitDialog:

CDatabase db;

if (db.OpenEx(_T("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\\Test.ACCDB;Pwd="), CDatabase::noOdbcDialog))
{
    AfxMessageBox(_T("DB Opened"));
    db.Close();
}

When I run this in DEBUG and simply start it, it opens the DB and then I shut down the application I get an exception:

enter image description here

I am building x64.

FYI:

My PC is:

  • Windows 11
  • Microsoft 365 64 bit

The callstack is:

    Mso20win32client.dll!00007ff9d322da31() Unknown
    Mso20win32client.dll!00007ff9d322d6c1() Unknown
    Mso20win32client.dll!00007ff9d32b8cea() Unknown
    Mso20win32client.dll!00007ff9d32b8c9a() Unknown
    Mso20win32client.dll!00007ff9d334978a() Unknown
    Mso20win32client.dll!00007ff9d3349754() Unknown
    Mso20win32client.dll!00007ff9d31f5624() Unknown
    Mso20win32client.dll!00007ff9d336485f() Unknown
    Mso20win32client.dll!00007ff9d335fdae() Unknown
    Mso20win32client.dll!00007ff9d335fd8e() Unknown
    Mso20win32client.dll!00007ff9d33748e0() Unknown
    Mso20win32client.dll!00007ff9d31f5624() Unknown
    Mso20win32client.dll!00007ff9d3315b31() Unknown
    Mso20win32client.dll!00007ff9d3315a94() Unknown
    Mso20win32client.dll!00007ff9d337da31() Unknown
    Mso20win32client.dll!00007ff9d31f5624() Unknown
    Mso20win32client.dll!00007ff9d333c1d3() Unknown
    Mso20win32client.dll!00007ff9d333c1ae() Unknown
    Mso20win32client.dll!00007ff9d336c8dc() Unknown
    Mso20win32client.dll!00007ff9d336c86d() Unknown
    ucrtbase.dll!<lambda>(void)()   Unknown
    ucrtbase.dll!__crt_seh_guarded_call<int>::operator()<<lambda_7777bce6b2f8c936911f934f8298dc43>,<lambda>(void) &,<lambda_3883c3dff614d5e0c5f61bb1ac94921c>>()    Unknown
    ucrtbase.dll!_execute_onexit_table()    Unknown
    Mso20win32client.dll!00007ff9d3385501() Unknown
    Mso20win32client.dll!00007ff9d338562a() Unknown
    ntdll.dll!00007ffaaa660277()    Unknown
    ntdll.dll!00007ffaaa6747f0()    Unknown
    ntdll.dll!00007ffaaa67465d()    Unknown
    kernel32.dll!00007ffaa941c66b() Unknown
    ucrtbased.dll!00007ff9d3b31bba()    Unknown
    ucrtbased.dll!00007ff9d3b31b65()    Unknown
    ucrtbased.dll!00007ff9d3b31f06()    Unknown
>   MFCApplicationDB.exe!__scrt_common_main_seh() Line 297  C++
    MFCApplicationDB.exe!__scrt_common_main() Line 331  C++
    MFCApplicationDB.exe!wWinMainCRTStartup(void * __formal) Line 17    C++
    kernel32.dll!00007ffaa94154e0() Unknown
    ntdll.dll!00007ffaaa62485b()    Unknown

In the comments it was suggested to load symbols, but I don't have Mso20Win32Client.pdb.

If I trace into clicking the Ok button to shutdown it eventually gets to this closing } in system code:

#pragma warning(suppress: 4985)
{
    // call shared/exported WinMain
    return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}

Went it hits that it crashes.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • What's the call stack at the time the exception is raise? How did code execution wind up in Mso20win32client.dll, and what is it trying to do there? Make sure to load symbols (by right-clicking the call stack frames) to get more useful information. – IInspectable Jun 08 '22 at 09:47
  • It's unusual for Microsoft to not supply at least public symbols to any of their shipped binaries. Have you made sure to instruct Visual Studio to load symbols from Microsoft's public symbol server? – IInspectable Jun 09 '22 at 13:45
  • @IInspectable Don’t know how??? – Andrew Truckle Jun 09 '22 at 14:06
  • 1
    In Visual Studio 2022 navigate to *Tools* -> *Options...*, then open *Debugging* -> *Symbols*, and make sure the checkbox for *Microsoft Symbol Servers* is set under *Symbol file (.pdb) locations*. – IInspectable Jun 09 '22 at 15:01
  • @IInspectable Sadly I am none the wiser even when they were ticked. – Andrew Truckle Jun 09 '22 at 15:16
  • @IInspectable For some reason the Mso20win32client.pdb is not in the cached folder, even though I ticked the box. – Andrew Truckle Jun 09 '22 at 16:51

0 Answers0