When instantiating a COM Interop object:
var comObj = new ComComponentClass();
I get the COMException
:
Retrieving the COM class factory for component with CLSID
{C343ED84-A129-11D3-B799-0060B0F159EF} failed due to the following error:
80040154 Class not registered
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I only get this error when I launch my application with Run as Administrator. When I run normally, the error does not occur.
Notes:
- The application is 64-bit application.
- The COM component is an inproc server in a 64-bit dll.
Any ideas as to where I should start investigating why this difference occurs?
What I've tried:
I've used Procmon to watch what registry keys it inspects.
- In both cases, the appropriate dll is located by inspecting the key
HKCU\Software\Classes\CLSID\{C343ED84-A129-11d3-B799-0060B0F159EF}\InprocServer32
- In both cases it queries the key
HKCR\CLSID\{C343ED84-A129-11D3-B799-0060B0F159EF}
and gets backNAME NOT FOUND
. Which I find strange (since I can find that key usingregedit.exe
. But since this doesn't differ between the two scenarios, it didn't seem important.