2012-09-18 98 views
1

當我嘗試使用CreateInstance調用實例化由com包裝的c#dll時,出現「Class not registered」異常。使用c#com在C++中包裝dll拋出類未註冊

以下是堆棧跟蹤:

'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Program Files (x86)\FlashGet\fgmgr.dll'. Module was built without symbols. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\comdlg32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\comctl32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wininet.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\normaliz.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\iertutil.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\urlmon.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mscoree.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sxs.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\msvcr80.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Loaded 'C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\acfc1391e45fedd2a359778ea57d914c\mscorlib.ni.dll'. 
'Test.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll'. Cannot find or open the PDB file. 
'Test.exe' (Win32): Unloaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Culture.dll' 
First-chance exception at 0x75E7B9BC in Test.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x004BDACC. 
First-chance exception at 0x75E7B9BC in Test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. 
First-chance exception at 0x75E7B9BC in Test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. 
First-chance exception at 0x75E7B9BC in Test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. 
+0

Does http://stackoverflow.com/questions/93770/eefileloadexception-when-using-c-sharp-classes-in-cwin32-app help? – nneonneo

回答

0

那麼,C#COM類沒有註冊。使用RegAsm.exe註冊C#COM DLL。

+0

我已經執行了Regasm命令,它導致說類型註冊成功,但是我得到了以下警告st(List)警告:沒有對嵌套數組的支持。 – TrustyCoder

+0

該代碼可能仍然工作,無需編組,但它通常是不安全的。我建議找到使用嵌套數組的替代方法。無論如何,它運行成功嗎? – user1610015

+0

我有同樣的問題沒有進展。我正在考慮在代碼中編寫一個自定義封裝。 – TrustyCoder