Search code examples
vb.netcomvb6com-interoptypelib

Interop Error 430 Class Does Not Support Automation


I have a VB.NET assembly that I have registered for Interop. I am using a class in this assembly in my VB6 projects.

In an existing VB6 project I added a reference to the type library and run the following code:

Dim vizDataSingleton As Vizual_Data.Singleton
Set vizDataSingleton = New Vizual_Data.Singleton

The second line errors "Run-time error 430: Class does not support Automation or does not support expected interface"

However if I start a blank VB6 project and add the reference, the exact same code works fine.

I checked the reference to the tlb in the vbp file and they are both identical.

Reference=*\G{BDB20DDF-D3B7-4484-8950-35D67DED45EC}#4.2#0#..\Vizual.Data\Vizual.Data\bin\Debug\Vizual.Data.tlb#VMS Data Structure Library

I tried using late binding as well:

Set vizDataSingleton = CreateObject("Vizual.Data.Singleton")

This errors in the existing project with "Type mismatch" but again works in the new project

Any ideas why this fails in one project but works in another?


Solution

  • I found the cause of this error in the end.

    I had another .NET Interop assembly (Vizual_Lib) that was dependant on the original .NET assembly (Vizual_Data).

    In the VB6 application that failed it was referencing both of these, but my new application only referenced Vizual_Data. Recompiling Vizual_Lib solved the issue.

    This was a strange error was the failure happened when using the Vizual_Data class not the other Vizual_Lib class.