NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling .NET with IXXAT

Hi All,

 

I have .NET driver for communication with our product via CAN bus using IXXAT driver.

It works fine if called from other c# classes not called from TestStand.

 

However, calling it from TestStand does return the following error:

 

Error: An exception occurred inside the call to .NET member 'GetDevices':
System.InvalidOperationException: GetEntryAssembly did not return a valid assembly reference
   at Ixxat.Vci4.VciServer.LoadServer(String assemblyloadpath)
   at Ixxat.Vci4.VciServer.Instance(String assemblyloadpath)
   at CanLibrary.Communication.GetDevices() in C:\Projects ATE\TestStand Driver\Communication.cs:line 123
   at libCan.Main.GetDevices() in C:\Projects ATE\libMantra\Class1.cs:line 14[Error Code: -2146233079, Code Module/User-defined error code. ]

 

Getting devices is standard IXXAT code:

 

IVciDeviceManager deviceManager = VciServer.Instance().DeviceManager;
devices = deviceManager.GetDeviceList();
foreach (IVciDevice device in devices)
{
   DebugPrint(device.Description);

}

 

Red part causes that error.

 

Calling others function (not related to IXXAT) work fine.

 

Hope anynone had such issue in the past.

 

Thanks!

 

 

0 Kudos
Message 1 of 6
(294 Views)

Please confirm if your driver is .NET Core or .NET Framework.  TestStand only supports .NET Framework. Refer to: TestStand and .NET Framework Compatibility - NI

Message 2 of 6
(286 Views)

Hi,

 

It is .NET Framework 4.8 and using latest TestStand version.

0 Kudos
Message 3 of 6
(273 Views)

Per Assembly.GetEntryAssembly Method (System.Reflection) | Microsoft Learn

"The GetEntryAssembly method can return null when a managed assembly has been loaded from an unmanaged application. For example, if an unmanaged application creates an instance of a COM component written in C#, a call to the GetEntryAssembly method from the C# component returns null, because the entry point for the process was unmanaged code rather than a managed assembly."

 

You have two options:

 

  1. If IXXAT provides a C/C++ driver use that instead and call it from a C/C++ TestStand adapter.
  2. Create a console executable application with arguments and return codes that uses the IXXAT driver.  Call the executable from a Command step from TestStand.
0 Kudos
Message 4 of 6
(246 Views)

My answer above was assuming that TestStand was Unmanaged, however it is a Managed application.  You could still try my suggestions to see what happens.

0 Kudos
Message 5 of 6
(214 Views)

Hi,

 

I figured out how to make it working. Someone had similar issue 8 years ago with Vector device:

 

https://stackoverflow.com/questions/33037263/teststand-action-sequence-using-a-c-sharp-dll-cant-inst...

 

Works perfectly implementing that solution.

 

Also have to mention, that I wanted to use existing C# code as all custom processing / addressing is already there, so don't have to spend time  repeating that again.

 

Hope it will help others.

0 Kudos
Message 6 of 6
(191 Views)