RobotStudio event

Problems loading AddIn in RS 5.61

Hi,

I've just upgraded to the new RobotStudio version and I'm having errors loading an addin which works perfectly in 5.15.  The program can't load it and shows the exception:

RobotStudio .NET exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
============================================
Base exception: ReflectionTypeLoadException
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at RobotStudio.Addin.TryLoad()

Any idea? I've created new addins and are loaded succesfully, so the problem is in the addin itself.
Thanks in advance.

Comments

  • HM
    HM
    Finally I found some issues. The class Network Scanner crashes in the constructor with SDK 5.15. This happens in my Addin but also in the examples (downloaded here: http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/413f6657-5da3-4ea7-ad79-77341f384f85.htm). Am I doing something wrong or it's an API's bug?
  • HM
    HM
    edited May 2014
    I forgot to post the exception:

    An unhandled exception of type 'System.TypeInitializationException' occurred in ABB.Robotics.Controllers.dll

    Additional information: The type initializer for 'ABB.Robotics.Controllers.Internal.NetworkScanner' threw an exception.

    The Guid needs to be altered to you local Guid. Debug and break on line 68(controller[0].SystemId) get the Guid from the system id property.
  • HM
    HM
    Hi, I'm debugging and getting this:

    "A first chance exception of type 'System.BadImageFormatException' occurred in ABB.Robotics.Controllers.dll
    A first chance exception of type 'System.TypeInitializationException' occurred in ABB.Robotics.Controllers.dll"

    so seems a problem with the x64 target.
  • HM
    HM
    edited May 2014
    RobotStudio .NET exception: The type initializer for 'ABB.Robotics.Controllers.Internal.NetworkScanner' threw an exception.
    ============================================
    Base exception: TypeInitializationException
    The type initializer for 'ABB.Robotics.Controllers.Internal.NetworkScanner' threw an exception.
       at ABB.Robotics.Controllers.Discovery.NetworkScanner..ctor()
       [...]
    Could not load file or assembly 'ABB.Robotics.Adapters.IRC5, Version=5.15.2005.2, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b' or one of its dependencies. The system cannot find the file specified.
       at ABB.Robotics.Controllers.Internal.NetworkScanner..ctor()
       at ABB.Robotics.Controllers.Internal.NetworkScanner..cctor()

    Is this solution still valid?

    I need to compile this as x64 target.
  • PerSvensson
    PerSvensson ✭✭✭
    Why do you need to compile it as x64?
    What .NET version are you using?
    Are you using the right assemblies?
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Hi,

    Finally I found that 5.60 PC SDK libraries, which run in 64 bits, are not installed with RS 5.60, and has to be installed after. I was using 5.15 instead, so it failed with the error pointed in the question I linked. So now I can compile the addin and execute it in 64 bits.

    But now I have another problem. I've just added a Dllimport to my addin to use a C++ third party library in it. When the addin is loaded a BadImageFormatException is thrown. The reason for a BadImageFormatException is that you try to import a 32-bit dll from 64-bit application or, more rarely, some strange situations like this: http://stackoverflow.com/questions/19302926/badimageformat-exception-at-runtime 

    I can ensure that all the imported dll's and the addin are compiled as 64-bit, so what could be the problem?
  • Finally I solved the problem and all is running. The reason for the last error was that I put the dll's directly in the Addins folder and RS tried to load them at start, so the exception was thrown. I solved it putting dll's inside a folder.

    Regards,
    HM
  • Hello,

    Has this something to do with my error? I want a solution for the problem below, can you help me?


    Can somebody help me. I want to export geometries to Sat file with the AddIn 'Export Geometries Add-In' in RobotStudio 5.60

    When I copy the 2 files, dll and rsaddin to the folder 'C:\Program Files (x86)\Common Files\ABB Industrial IT\Robotics IT\RobotStudio\Addins' I get the error below when opening robotstudio!

    What do I do wrong?

    Best Regards,

  • HM said:
    RobotStudio .NET exception: The type initializer for 'ABB.Robotics.Controllers.Internal.NetworkScanner' threw an exception.
    ============================================
    Base exception: TypeInitializationException
    The type initializer for 'ABB.Robotics.Controllers.Internal.NetworkScanner' threw an exception.
       at ABB.Robotics.Controllers.Discovery.NetworkScanner..ctor()
       [...]
    Could not load file or assembly 'ABB.Robotics.Adapters.IRC5, Version=5.15.2005.2, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b' or one of its dependencies. The system cannot find the file specified.
       at ABB.Robotics.Controllers.Internal.NetworkScanner..ctor()
       at ABB.Robotics.Controllers.Internal.NetworkScanner..cctor()

    Is this solution still valid?

    I need to compile this as x64 target.
    Hi,HM.thank you for your attention.Is there any connection between your montioned above and my error? can you help me? I want to create a simple PC SDK application as application manual of PC SDK mentioned,failed in initialization of NetworkScanner class .My project is set to x86, ABB.Robotics.Controllers.PC.dll version 6.3.7016.2009, the same as Robot Communication Runtime. May I ask you, what is the problem and what is the solution, thank you very much!