0

i have issue when i try to run CANalyzer from vb.net more precisely at this point canApp = New CANalyzer.Application. visual basic display this :

System.InvalidCastException : 'Unable to cast COM object of type 'System.__ComObject' to interface type 'CANalyzer.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{4C8C05A7-13BB-4B14-983C-10C739C0C089}' failed due to the following error: Erreur lors du chargement de la bibliothèque/DLL du type. (0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

NB: i've already run CANalyzer before it worked pretty well. I installed several version of CANalyzer recently and i think that can be the reason but i'm not sure.

The code.

Imports System
    
    Module Program
        Sub Main(args As String())
            Dim canApp As CANalyzer.Application
            canApp = New CANalyzer.Application
        End Sub
    End Module

'''

yankov
  • 1
  • 3
  • Did you try to unregister the interop and register again? Take a look at page "Computer Configuration (COM Interface)" in CANalyzer's help. It describes everything you have to do when you have multiple versions installed and want to use COM. – MSpiller May 17 '22 at 14:36
  • for both commands canoe32 -regserver /-unregserver i've got message unregistration/registration failed 0x80070005. So I tried to run RegisterComponents as I saw it somewhere online it worked, but the problem (System.InvalidCastException...) remained the same. – yankov May 17 '22 at 15:49

1 Answers1

0

in case you have installed several versions of CANAlyzer, VStudio will probably mismatch the keys for an interface identifier (IID); You have two or more keys for a same ID . In this case you have to delete the keys that doesn't match your CANalyzer version.

The steps to know the proper key and delete the wrong ones are very well shown in this youtube video :

yankov
  • 1
  • 3
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 19 '22 at 00:25