-
May 25th, 2022, 09:15 AM
#1
Thread Starter
New Member
COMInterop - System cannot find file - VB6 IDE only
Hi
I've an old VB6 program which I have haven't used for several months. The program references numerous C# assemblies (.NetFramework 4.8). Running the programs as binaries, it all works fine.
I have opened the VB6 ide to step some of my code and I am now encountering an automation error "The system cannot find the file specified." (Err 80070002) when trying to instantiate one of the COM Interop classes. This didn't used to happen.
Code:
Private Sub InitMessageStore()
Dim l_oBusFactory As IfxBusService.BusFactory <= COM Interop reference
Set l_oBusFactory = New IfxBusService.BusFactory <= ERROR here
l_oBusFactory.InitialiseMessageStore GetConnection(m_oIfxsys.Dbase.Database.Definition)
End Sub
The COM Interop decls
Code:
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IBusFactory))]
[Guid("200C6C26-6881-4CB5-A8E7-E0E5532D6D5F")]
public class BusFactory : IBusFactory
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("5531BD20-2C7B-452B-A7D7-2D05E39EB83E")]
public interface IBusFactory
I have rechecked the registry registrations for the above ... the salient one being
and the file is in the folder location as specified in the registry.
I'm using Win10 Version 10.0.19044 Build 19044. I'm running everything as administrator. I have DEP switched to essential Windows programs and services only.
As I said above, everything works fine when run as binaries, but, to me, it looks like the OS is stopping the VB6 ide from loading a COM Interop assembly.
Any suggestions as to how I can get stepping through (but not necessarily into) my COM Interop code working again.
-
May 25th, 2022, 09:28 AM
#2
Re: COMInterop - System cannot find file - VB6 IDE only
Moderator Actions: Moved to VB6 and Earlier
-
May 25th, 2022, 10:07 AM
#3
Re: COMInterop - System cannot find file - VB6 IDE only
Did you try creating a new VB6 project to test the COM component? Create a new VB6 project then add a reference to COM Interop type library and try to instantiate your object. See if that fails. The idea here is to confirm or rule out any kind of corruption in your project files.
-
May 25th, 2022, 10:16 AM
#4
Thread Starter
New Member
Re: COMInterop - System cannot find file - VB6 IDE only
Thx.. Just tried that. Same result .. same error
Code:
Private Sub Form_Load()
Dim f As IfxBusMessages.MessageFactory
Set f = New IfxBusMessages.MessageFactory
End Sub
-
May 25th, 2022, 10:34 AM
#5
Re: COMInterop - System cannot find file - VB6 IDE only
Is the C# assembly written by you or is it a 3rd party component you downloaded from the internet?
-
May 25th, 2022, 10:37 AM
#6
Re: COMInterop - System cannot find file - VB6 IDE only
Also, I want you to go to your project references in VB6 and tell me if you're referencing the C# component through a type library or a DLL. Just look at the extension of the file it's referencing. A type library would have .tlb and a DLL would be .dll
-
May 25th, 2022, 10:49 AM
#7
Thread Starter
New Member
Re: COMInterop - System cannot find file - VB6 IDE only
It's mine. It just references NLog.
Sorry ... just read about the ref ... it is ref'ed as a typelib.
(I've also just noticed that my test refers to a different .net component I'm referencing.
Code:
Set l_oBusFactory = New IfxBusService.BusFactory
Set l_oMessageFactory = New IfxBusMessages.MessageFactory
I'm experiencing the same issue with all the .Net components I'm referencing via ComInterop)
EDIT:
I've just tried to create a completely new ComInterop Test proj which references NLog and gets called from a vb6 test project. It seems to work fine! So must be something to do with my setup ...
Last edited by woopsie; May 25th, 2022 at 11:39 AM.
Reason: Additional info
-
May 25th, 2022, 11:28 AM
#8
Re: COMInterop - System cannot find file - VB6 IDE only
Ok. Do you consider this C# component proprietary software? If not, can you upload it so I can take a look at it?
-
May 25th, 2022, 11:42 AM
#9
Thread Starter
New Member
Re: COMInterop - System cannot find file - VB6 IDE only
Unfortunately, it is proprietary.
-
May 25th, 2022, 11:50 AM
#10
Re: COMInterop - System cannot find file - VB6 IDE only
Ok that's fine. Help me to understand what your binaries look like. You said it references a type library from VB6 yet there is obviously executable code which means there will also be a DLL that this type library references for this code. So what I'm trying to understand is if the type library and the DLL are separate from each other. Can you tell me if this is the case?
If so, I assume all the files are in the same folder?
Also, your small test project, did you try compiling that to see if it works as an EXE?
-
May 25th, 2022, 12:06 PM
#11
Thread Starter
New Member
Re: COMInterop - System cannot find file - VB6 IDE only
Actually I think I've just cracked it ... though I'm not sure how this has arisen...
In the registry entry for test project, the guid of the implementing class has one InprocServer32 entry v1.0.0.0.
In the registry entry for failing project, the guid of the implementing class has 2 InprocServer32 entries v1.0.0.0 which contains the correct path to the file and another one for v5.80.0.111 which doesn't have the correct path.
If I delete the latter one, I can now step the code.
I've just noticed that the failing projects now have both a AssemblyInfo and a GlobalAssemblyInfo which I think is a change introduced for our build process and although it works for runtime it may have knocked things out for debugging. Neither of them specify v5.80.0.111, though, so I'm really not sure where those inprosever32 entries will have come from. If I rebuild the solution, only one 1 InprocServerEntry32 entry appears- the correct one.
(BTW, many thx for all the help.)
Last edited by woopsie; May 25th, 2022 at 12:36 PM.
-
May 25th, 2022, 12:44 PM
#12
Re: COMInterop - System cannot find file - VB6 IDE only
Ah ok. Glad you solved it.
COM is tricky because of how easy it is to break. A wrong GUID here or a wrong path there is all it takes. My line of questioning was me trying to narrow down where the point of failure actually was. Problems like this is one of the main reasons I abandoned VB6 for .Net. In my VB6 days I spent a great deal of time debugging issues like this.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|