02-22-2024 04:48 AM
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!
02-23-2024 09:51 AM
Please confirm if your driver is .NET Core or .NET Framework. TestStand only supports .NET Framework. Refer to: TestStand and .NET Framework Compatibility - NI
02-24-2024 10:59 AM
Hi,
It is .NET Framework 4.8 and using latest TestStand version.
02-26-2024 09:40 AM
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:
02-28-2024 11:18 AM
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.
03-01-2024 07:44 AM
Hi,
I figured out how to make it working. Someone had similar issue 8 years ago with Vector device:
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.