Skip to Main Content
Centro de soporte de Cognex
LogoLogo

Exception Has Been Thrown by the Target of an Invocation

Fix for VisionPro error due to targeting incorrect CPU architecture in Visual Studio

15/09/2024

Details

Issue:

Error in VisionPro when compiling code in Visual Studio: "Exception has been thrown by the target of an invocation."

Causes:

Incorrect chip architecture targeted.

Resolution:

Switch the project properties to x64. The build properties should will not work on "Any CPU".  

Other notes:

  1. Check that VisionPro is installed on a clean machine. You probably need to clean up the registry (remove all reference to Cognex) and make sure no old VisionPro assemblies remain on the \Windows\assembly directory  
  2. Verify that you have the following file where VisionPro is installed:  

    C:\Program Files\Cognex\VisionPro\bin\Templates\Tools\ID & Verification\Cog2DSymbolTool.vtt.  

    Cog2DSymbolTool.vtt is a tool template. You can try to remove your own tool .vtt file if there is any.  

  3. Check newly created assemblies and their references. You can simply remove your .dll from VisionPro\bin directory 

Recursos relacionados