Results 1 to 12 of 12

Thread: COMInterop - System cannot find file - VB6 IDE only

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    8

    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

    Name:  reg.jpg
Views: 169
Size:  10.4 KB

    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.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: COMInterop - System cannot find file - VB6 IDE only

    Moderator Actions: Moved to VB6 and Earlier
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    8

    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

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  6. #6
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    8

    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

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    8

    Re: COMInterop - System cannot find file - VB6 IDE only

    Unfortunately, it is proprietary.

  10. #10
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  11. #11

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    8

    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.

  12. #12
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

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
  •  



Click Here to Expand Forum to Full Width