Strange Exception when run project on debug mode RRS feed

  • Question

  • Hi, I have a very strange situation...

    Current configuration and Platform:

    OS: Window 7 64 bit, Visual Studio 2010, Project Type: Windows Form, Target Framework: 4.0
    Note: target CPU x86

    in my project I use a third part component ActiveX for manage Digital Signature USB Token (PkNet from IntesiGroup),
    this from many years without a problem .

    From a few days, when run the project in debug mode, when create a new instace of a class of this component, i get exception

    "Retrieving the COM class factory for component with CLSID {B8D33AB8-A55B-483B-9C62-3F0C853771E1} failed due to the following error: 8007045a."

    I think that the problem is not the installation/registration of component because:

    Strangeness 1: If I run the compiled program, the problem does not occur

    Strangeness 2: if i switch target framework to 2.0 and run on debug, the problem does not occur

    i try to:
    - re-register the component (with regsvr32)
    - back Windows to "restore point"
    - reinstall Visual Studio & Framework
    - check for Windows Update & patch…
    nothing … the Problem persist
    Check on event-viewer but i dont see anything

    The really weird thing is that i have installed new Hard Disk on my machine, installed Window 10 with Visual Studio 2017 Community, convert the project and I have the same problem!!

    Note: my colleague with the same configuration, and run the same project don't have any problem


    Barbolini Rodolfo

    Datagraph srl

    • Edited by Maverik04 Tuesday, June 12, 2018 3:18 PM
    Tuesday, June 12, 2018 3:15 PM

All replies

  • Did you try removing the component from your project, deleting the COM interop file and then adding the ActiveX component back in to your project?

    Also, assuming this is a 32-bit ActiveX component, did you verify that your app is running 32-bit and not 64-bit? You should be able to use Task Manager to check this.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, June 12, 2018 3:30 PM
  • Thanks for your quicky response.

    When i started to try resolve the problem, i create a new blank project with one form and one button, and added a reference to the Com Component. Set Target CPU to X86 to run 32 bit application is the first operation;

    and in fact  if i change target CPU to AnyCPU (and the app run on 64 bit) the error is different:

     (Eccezione da HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

    that is an exception that i know

    Barbolini Rodolfo


    Barbolini Rodolfo Senior Developer Datagraph srl

    Tuesday, June 12, 2018 3:44 PM
  • The error 0x8007045a is ERROR_DLL_INIT_FAILED. This should be what the last error is set to when LoadLibrary tries to load a DLL which returns FALSE from the DllMain's DLL_PROCESS_ATTACH handler.

    So the library that contains the COM component is failing for some reason, unless you have the code for the COM component then you really need to contact the software vendor, since their code is failing.

    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Tuesday, June 12, 2018 4:09 PM
  • I would make sure you don't have any duplicate versions of the component registered and that the CLSID is pointing to the correct file location.

    Also, you may want to try running the Process Monitor utility to see if there are any errors or security issues when loading this component.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, June 12, 2018 5:03 PM
  • unregister the activex component using regsvr32 and search in the registery for that activex and delete if you find any( I would suggest delete typelib if you find any with the activex component name) and Re - register the component using regsvr32.
    • Proposed as answer by adushetty Wednesday, June 13, 2018 4:25 PM
    Tuesday, June 12, 2018 5:07 PM
  • Thanks,

    but I tryed it as the first operation before post the problem.

    Barbolini Rodolfo

    Barbolini Rodolfo Senior Developer Datagraph srl

    Thursday, June 14, 2018 7:12 AM