vb.netcaplcanalyzer

CAPL COM server (VBnet) - CANalyzer failed to open


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

'''


Solution

  • 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 :