Wizard generated project issue - asserts trying to update registry.

  • Thread starter Thread starter RD Holland
  • Start date Start date
R

RD Holland

Guest
I created a VS 2019 c++ MFC project using the OLE server setting (full server, not mini-server). When I build the project, the first issue I have is when code is generated:

>Generating Code...
1>MFCCefServer.vcxproj -> C:\Users\rdhollan\source\repos\MFCCefServer\Debug\MFCCefServer.exe

A dialog pops up "Microsoft Visual c++ Runtime Library" Debug Assertion Failed. Line 362 of d:\agent__work\3\s\src\vctools\VC7Libs\Ship\ATLMFC\Src\MFC\Olereg.cpp.

I can hit ignore and the linking finishes. I've never seen that before.

Now I try to run the app and in the xxxServer.cpp file, I have this call in the generated file:

m_server.UpdateRegistry(OAT_DOC_OBJECT_SERVER);

That generates another assertion (the same one during the build) due to this check:


// protect against registering an invalid DocObject server
ASSERT(nAppType != OAT_DOC_OBJECT_SERVER ||
(AtlStrLen(table.GetAt(8)) != 0 && lstrcmp(table.GetAt(8), _T(".*")) != 0));

So, it looks like the wizard generated code is designed to cause this assertion.

I am on Windows10 and I ran VS 2019 as an admin (need that to even write to the registry).

This assert means the AfxOleRegisterHelper API isn't called to update the registry. My file extension never shows up in the registry and I assume this is why.

I have VS2019 Version 16.0.5. I did not modify any code. This is the completely auto-generated code causing this.



R.D. Holland

Continue reading...
 
Back
Top