Thanks for reaching out based on the details you shared the issue occurs because a 64 bit dot net process cannot directly load a 32 bit COM DLL. This limitation is by design on windows- 32 bit COM components require a 32 bit host process.
Root cause
- Your COM DLL is registered using regsvr32.exe (32-bit) -> it registers under HKCR\WOW6432Node.
- Your application is running as 64 bit so it looks for the COM class under the 64 bit registry hive, where it does not exist
- therefore, the class shows as not registered
This is why the application works when compiled as x86, but not AnyCPU/ x64.
Workarounds
- Run your WPF application as 32 bit(recommended and easiest) since the COM DLL is 32 bit compile your application as: project-> properties-> build-> platform target-> x86 this forces the application to run in 32 bit mode and allows the COM DLL to load normally. This is the officially supported method.
- Use a 32 bit “COM proxy host” end call it from your 64 bit application windows does not support in process Cross-bit COM loading. However, you can place the 32 bit COM component in a separate 32 bit EXE host, and your 64 bit process can communicate with that EXE using:
- WCF
- Named Pipe
- Out-of-proc COM
- gRPC/REST
- .NET remoting (legacy)
- If the vendor supports it obtain a 64 bit version of the** **COM DLL if available, replacing the DLL with a native x64 COM library resolves the issue completely
what does not work
adding registry keys under:
HKLM\Software\Classes\CLSID\{GUID}
HKLM\Software\Classes\AppID\{GUID}
will not fix the issue
the problem is not registration the problem is bitness mismatch, and windows will not load a 32 bit COM DLL inside a 64 bit process.
Please let us know if you require any further assistance we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer".