Menu

#24 System.InvalidCastException: Return argument has an invalid type.

v1.0_(example)
open
nobody
None
5
2014-11-13
2014-11-13
Olivier D
No

I’m working in a team that automatized measurement to characterize chips. Our environment is write in Python and we build drivers for each equipment.
Today I have trouble with an Tektronix Logic Analyzer (TLA7012). Tektronix give a DLL write in .NET to access to the equipment (TlaNetInterfaces.dll) and examples in C++, C# or VB but not in Python.

We began to access using Ethernet with success, but when we use a method that return a .NET reference we have an error. The same code has been built with Labview without problem.

Here my code:

Import clr
Slot = 1
Clr.AddReference(“TlaNetInterfaces”) # load the DLL reference on TLA
configFile= “Connect.config” # config file that contain IP address of TLA
ITlaSystem_reference= clr.Tektronix.LogicAnalyzer.TpiNet.RemoteTlaSystem.Connect(configFile) #open connection on TLA
ITlaSystem_object= clr.Tektronix.LogicAnalyzer.TpiNet.ITlaSystem(ITlaSystem_reference)
Print ITlaSystem_object.SWVersion #return TLA software version 5.8.027.0 for my case
UserName= ITlaSystem_object.GetModuleBySlot(slot) # It should return a reference on module slot 1 in the TLA

The last line of this code give me this error:
System.InvalidCastException: Return argument has an invalid type.

I try to convert the value return, but without success, I always have this error, like .NET module in python don’t support a reference return from a method.
If I can get this reference I can access to all other part of the equipment for example running an acquisition, but actually it’s not possible.

Do you have an idea where is the problem?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.