简体   繁体   中英

Howto troubleshoot vb6 dll 800a01ad error in c# application

I have a dll that I created from a VB6 project that I am now using in ac# project. This has worked before but now when I try to return to the c# project to fix a bug, the program get a COMException stating roughly translated:

Could not create an instance of COM-component with CLSID {085E3494-9F78-47D5-B0E6-FA460FD3CBED} from IClassFactory because of the following error: 800a01ad.

So I try to create a new empty c# project with only one line in the main function:

OurNamespace.OurClass foo = new OurNamespace.OurClass();

Which fails with the same error.

I have registered the dll but that did not change the outcome of the problem.

The problem only occurs on the machine I am currently at, still I'm interested to understand the problem so that I know how to fix it if it occurs on a customers computer.

This translates to VB6 runtime error 429, "ActiveX can't create object". It is not your C# code that is failing, it is the VB6 code that has a problem. You can only get somewhere by debugging the VB6 code. You'll need the VB6 IDE, load the library project, set your C# program as the start program and set a breakpoint on the Class_Initialize subroutine of the class you are trying to create in your C# code.

Working from the assumption you don't have the tools anymore, error 429 has a lot of potential causes. The most common one is a registration problem, solved by running Regsvr32.exe on a DLL that the VB6 code uses.

请尝试按照此kb文章中的步骤操作,以查看是否有帮助http://support.microsoft.com/kb/194801

Compile your VB6 DLL with Binary Compatibility set. Otherwise the GUID of your VB6 DLL keeps changing every time you compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM