views:

140

answers:

3

I have a dll that I created from a VB6 project that I am now using in a c# 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.

+1  A: 

Try following the steps from this kb article to see if it helps http://support.microsoft.com/kb/194801

Sijin
+2  A: 

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.

Hans Passant
The problem was another missing dll referenced by the VB6 dll. Although I couldn't det the VB6 debugging running, it got me looking in the correct place.
phq
A: 

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

AngryHacker