none
Old C# COM add-in with 64-bit shim not loading, but 32-bit works fine RRS feed

  • Question

  • Hi All,

    I have inherited an old COM C# addin and I am moving it to Visual Studio 2017 along with fixing several bugs that have existed for sometime. The add-in is using .NET 4. I have a 32-bit shim and a 64-bit shim. I got the 32-bit addin to work fine. However the 64-bit add-in does not work/load. I have registered the shim, and  it registers fine. When I start Outlook the add-in gives a runtime error. I put a breakpoint in the shim and the shim does not even load. Running out of the debugger I see  these errors in the output window when I try to enable the COM add-in (64-bit shim)

    onecore\com\combase\dcomrem\resolver.cxx(2279)\combase.dll!00007FFE122D96F0: (caller: 00007FFE1234E463) ReturnHr(38) tid(47b8) 80040154 Class not registered

    onecore\com\combase\dcomrem\resolver.cxx(2483)\combase.dll!00007FFE1234E48A: (caller: 00007FFE122D8779) ReturnHr(39) tid(47b8) 80040154 Class not registered

    I have no clue what is giving me the class not registered errors. Does anybody have any clue as to what is going on? I am not even hitting the breakpoint in DLLmain. If I did not know any better, I would believe this is something to do with an old ATL class, but I am not sure. Any thoughts?

    Ref page: https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb508939(v=office.12)?redirectedfrom=MSDN

    Thanks,

    Tom


    • Edited by Thomas Lee3 Wednesday, November 6, 2019 3:04 AM
    Wednesday, November 6, 2019 2:42 AM

Answers

  • I completely recreated the project using ATL VS 2017, and removed all of the questionable COM functionality and replaced with stuff that I knew worked, and the add-in worked. I truthfully do not know how this add-in ever worked.

    Thanks for your suggestions, Dmitry.

    • Marked as answer by Thomas Lee3 Wednesday, November 6, 2019 8:00 PM
    Wednesday, November 6, 2019 8:00 PM

All replies

  • How did you install the addin?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, November 6, 2019 4:05 AM
  • I registered it using the following

    HKCR
    {
    	TheAddIn.Connect = s 'Connect Class'
    	{
    		CLSID = s '{b03a30c1-424b-4a53-8f1c-b563fe93a162}'
    	}
    	NoRemove CLSID
    	{
    		ForceRemove '{b03a30c1-424b-4a53-8f1c-b563fe93a162}' = s 'TheAddIn.Connect'
    		{
    			ProgID = s 'TheAddIn.Connect'
    			InprocServer32 = s '%MODULE%'
    			{
    				val ThreadingModel = s 'Apartment'
    			}
    			
    		}
    	}
    }
    
    HKCU
    {
    	NoRemove Software
    	{
    		NoRemove Microsoft
    		{
    			NoRemove Office
    			{
    				NoRemove Outlook
    				{
    					NoRemove Addins
    					{
    						ForceRemove TheAddIn.Connect
    						{
    							val 'Description' = s 'My 64-bit Outlook Connector'
    							val 'FriendlyName' = s 'My 64-bit Outlook Connector'
    							val 'LoadBehavior' = d 3
    						}
    					}
    				}
    			}
    		}
    	}
    }
    

    Wednesday, November 6, 2019 3:30 PM
  • Was 'TheAddIn.Connect' key created under the Wow6232Node? In that case 64 but process (outlook.exe) will not see it.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, November 6, 2019 3:55 PM
  • No it was not under the Wow6232Node. It is properly registered as a 64-bit add-in

    Outlook does see the add-in, but when I try to enable the add-in I see the two those two runtime errors above (in the Visual Studio Debugger) and the add-in does not load. The Outlook dialog displays the following message.

    "Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in."

    I have dealt with a number of C++ 64-bit add-ins and usually it is something obvious during the load of the add-in.

    However, for this particular add-in, I do not even hit the break point in the COM component for the DLL load (DLLMain). So I am missing something. It registers, but will not load.

    This project was developed in VS 2008 ATL. So I might try recreating the project under 2017. I have went through the settings with a fine tooth comb, and I have not found anything that stands out yet.

    Wednesday, November 6, 2019 5:09 PM
  • I completely recreated the project using ATL VS 2017, and removed all of the questionable COM functionality and replaced with stuff that I knew worked, and the add-in worked. I truthfully do not know how this add-in ever worked.

    Thanks for your suggestions, Dmitry.

    • Marked as answer by Thomas Lee3 Wednesday, November 6, 2019 8:00 PM
    Wednesday, November 6, 2019 8:00 PM
  • Have you tried to use Process Monitor to see if some missing dll was being loaded?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, November 6, 2019 8:27 PM