Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

DEMO_NET

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi,

I'm trying to run the DEMO_NET project. The project builds without any errors or warnings, however when I try to execute the application I get an error that no ANT product was found.

I've altered the try catch block in the INIT() function to output the full exception error message and I get the following output:

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

I've made sure all the DSI_*.dll and ANT_*.dll files are in the working directory however I cannot seem to get past this error.

Any help would be appreciated!

Thanks,
John

NB: Note that I'm compiling this with VS2008 on Windows 7. I have an ANT+ USB stick connected to the PC.      
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

Is your computer a 64 bit system?
The DSI_*.dll's are 32-bit - you will need to build your project as a 32 bit configuration (x86) instead of AnyCPU.

See
http://dobrzanski.net/2010/06/29/attempt-load-program-incorrect-format-exception-hresult-0x8007000b/      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Thanks - that makes sense. I've changed the targeted CPU to x86 and no longer get that error. However now I just get the following exception raised when trying to initialise an ANT_DEVICE object:

"ANTLibrary Exception: Failed to connect to any ANT devices"

The USB stick is connected and is showing as "active" in the Garmin ANT Agent tool....      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

On further investigation I've found that after setting the targeted CPU to x86 I am able to connect to the USB stick using the ANT_FS library. Using the ANT_NET library I'm able to see that a USB device has been found (device count = 1) - but creating an instance of ANT_DEVICE throws an exception that no ANT devices have been found.

I am considered signing up as an alliance member - but would like to make sure I can get the basics working before I do so. At the moment I just can't get past the ANT_Device exceptions.

Thanks,
John      
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

The USB stick is connected and is showing as "active" in the Garmin ANT Agent tool....


The USB stick can only be used by one application at a time. Make sure you close ANT agent before trying to connect from your own application.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

I thought that might be the case - and so I shut down the Garmin ANT Agent tool. However I still get the same message. Is there a way to determine which applications are using the USB stick? Or is there a way to close all connections to a USB stick?      
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

If ANT agent is already closed, that should not be a problem. You can remove and reinsert the stick just to make sure. What ANT product are you using?

Most likely, some of the libraries required to access the USB stick (DSI_*.dll and ANT_*.dll) are not available in the working directory of your application. The working directory is set in the Visual Studio project settings, double check its location and the presence of the DLL's in it.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Thanks - I've corrected the issue now. It turns out that there were concurrent sessions open on the development PC. Whilst I had closed ANT Agent on the session I was working on, there was another instance running under a different user.

Once I closed all instances I was able to communicate with the USB stick.

It would be useful if the ANT Windows Library was able to report that the USB found by ANT_Common was in use and by which application.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi

Im using Visual c# V10 and didnt have the options from the dobrzanski.net link -

dobrzanski.net/2010/06/29/attempt-load-p...-hresult-0x8007000b/

Luckily ANTWAREII compiled and worked on V10 so I cross referenced the csproj files and made the following change to target x86 -


<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>$(SolutionDir)\\$(Configuration)</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
x86</PlatformTarget>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>

<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>$(SolutionDir)\\$(Configuration)</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
x86</PlatformTarget>
</PropertyGroup>

Hope this is useful      
Rank

Total Posts: 2

Joined 0

PM

Johnny, try setting yur debug build instead of 'Any CPU' or x64 to x86, the NET demos are 32 bit. I had the same problem and this solved it. Hope this helps.      
Rank

Total Posts: 2

Joined 0

PM

To clarify, i meant set your target platform to x86 as the NET managed DLLs are for 32 bit environment.