dev [Solved] BadImageFormatException:

Home Forums EyeX Software Development dev [Solved] BadImageFormatException:

This topic contains 20 replies, has 3 voices, and was last updated by Profile photo of Grant [Tobii] Grant [Tobii] 4 days, 4 hours ago.

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #7039
    Profile photo of Devi
    Devi
    Participant

    Hi I am new to the Tobii eyex development. I have created a windows form application which has two buttons. My object is to when look at the Particular button that should trigger the button click. But the problem is it is not executing the activated event from the EyeX Engine to trigger the click.
    Also another issue is I am not able to run the Sample code ActivableButtonForms and it gives an like this: “BadImageFormatException: using An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)”. I am using Visual studio 2012 32bit
    Please help me.

    #7048
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @devi,

    The BadImageFormatException when loading a dll is caused by incompatible bitness (32 or 64-bit) on the solution/project vs. the DLL.

    To resolve the error, you can either:
    – Change target platform to x86 in your Visual Studio solution
    – If you want to build a 64-bit application, change the references for the two DLLs Tobii.EyeX.Client.dll and Tobii.EyeX.Client.Net20.dll to the 64-bit versions, located in \lib\x64

    Hopefully once you get the Activatable Buttons sample going, it should clear up your remaining doubts.

    Please let us know how you get on.

    #7060
    Profile photo of Devi
    Devi
    Participant

    Hello,
    I have changed the target platform to x86, but I am getting the same error. I am attaching the screen shot of the configuration and the error
    Error and Configuration image

    Thanks

    #7061
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @devi, sorry the image was not sent.. can you send a link to imgur instead? thanks

    #7074
    Profile photo of Devi
    Devi
    Participant

    Hi @Grant[Tobii]
    Error
    Configuration

    #7075
    Profile photo of Devi
    Devi
    Participant
    #7078
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @devi, thanks for that.. can you please confirm the location of the Tobii.EyeX.Client.dll and Tobii.EyeX.Client.Net20.dll files on your system and that you have added this location to the path directory in the Visual Studio project? It seems from the error, that VS simply cannot find the DLL as needed.

    #7080
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    I would also advise you to have a look over a tutorial we produced detailing the steps to get up and running on Visual Studio @ http://developer.tobii.com/walkthrough-setting-cc-project-eyex-c-api/

    #7245
    Profile photo of 良治
    良治
    Participant

    I use Tobii.Interaction v0.7.3 nuget package and trying to run Tobii API.
    It runs well in a AnyCPU config, but it faces the BadImageFormatException problem in 64 app config which I need to build.
    My app refers to two dlls – Tobii.Interaction.Model.dll and Tobii.Interaction.Net.dll.

    You wrote:
    >>to build a 64-bit application, change the references for the two DLLs Tobii.EyeX.Client.dll and Tobii.EyeX.Client.Net20.dll to the 64-bit versions, located in \lib\x64

    The nuget package include the following folder tree:
    Interaction –
    build
    x64
    Tobii.EyeX.Client.dll
    lib
    net45
    Tobii.Interaction.Model.dll
    Tobii.Interaction.Net.dll

    There are no \lib\x64\*.dll. Where can I get x64 version of Tobii.interaction.*.dll?

    #7246
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @ysato,

    Something quick to check is within the project properties for visual studio is if “Prefer 32-Bit” has been enabled?

    And rerun nuget for the Tobii Interaction Package.

    #7251
    Profile photo of 良治
    良治
    Participant

    Tobii dll works when “Any CPU” && “Prefer 32-bit” was enabled,
    but it doesn’t when 64 bit config is selected.

    I tried
    1) uninstall Tobii.Interaction package
    2) set project config as 64 bit target.
    2) install again Tobii.Interaction package.
    But I find the same load error with BadImageFormatException message.

    If Tobii.interaction NuGet package should support 64 bit, this looks a bug of package creation.

    #7253
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @ysato, sorry to hear about your issues.

    Were you able to at least successfully run the samples included with the Core SDK available @https://github.com/Tobii/CoreSDK

    I was able to run both 32 and 64bit variants of these samples on my system without issue
    using the Tobii Interaction Nuget Package.

    What happens when you try it with for example the Interactions 101 sample?

    I did have issues with Visual Studio 2017, and so use 2015.. maybe you can try that?

    #7255
    Profile photo of 良治
    良治
    Participant

    I experimented to run Interaction Interactors 101 sample in CoreSDK. I use VS 2015.

    It runs with Any CPU + “Prefer 32-Bit”.
    It neither run with “Any CPU + NOT prefer 32bit” nor “64bit target”. They show the same error “BadImageFormatException” at the line of “var host = new Host();”

    VS 2015 configuration manager of Tobii SDK projects, even 64 bit does not show up in configuration choice menu.

    #7256
    Profile photo of Grant [Tobii]
    Grant [Tobii]
    Moderator

    Hi @ysato, It’s rather odd as I have the same setup as was able to get it working with little problem.

    I wonder, can you build to 64bit a regular application (ie not using Tobii SDK?)

    You could try uninstall NuGet Package, then change build conditions to 64bit, then install again “Tobii Interaction” package.

    Out of curiosity, is there a chance you can try building on another system just to check?

    #7257
    Profile photo of 良治
    良治
    Participant

    I compared Tobii dlls between two configs:
    – Nuget install for Project config 64bit
    – NuGet install for project config Any CPU (32bit prefered)

    However Dll files are the same between those two configs.
    Tobii.Interaction.Model 0.7.3.333 95.5KB 2017/06/06 13:15
    Tobii.InteractionNet 0.7.3.333 176KB 2017/06/16 13.15

    If Nuget package should install different dlls, the file size must be different. (64 bit ones should be bigger).

    I am developing a c# application which uses (1) Tobii package and (2) 64 bit dll which I build by myself (64bit OpenCV wrapper).
    When I set app config 64bit, the Tobii dll load fails.
    When I set app config Any CPU (32bit prefered), the 64bit dll load fails.
    Current Tobii dlls must be for 32bit, and not support 64bit.

Viewing 15 posts - 1 through 15 (of 21 total)

You must be logged in to reply to this topic.