09-25-2009 05:45 AM
Hi,
I have a .NET application written in C# which has a UI with
NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit controls. This UI is invoked by a custom step in TestStand. One of the values, entered by user in the UI is a object reference variable created in a previous step. I need to store the values entered in the UI during the edit mode of the step, into the TestStand Step variables. And during the run mode i use these values to execute the logic in C#.
The problem is during edit time, the object reference variable, entered in the UI, has no value. It is null. So there is no use storing it at edit time. During the runtime i am trying to retrieve the value of the object reference variable using GetValInterface(...) and GetValIDispatch(..) methods of PropertyObject. But the object returned to C# is of type System.__COMObject wherease in TestStand that object reference is of type .NET.
I don't know how a .NET object reference is converted to COM object when it is returned to .Net function.
Also is there any other method to send this object reference variable's (whose value is '.NET' in previous step itself) value to .NET as a .NET object only so that i can typecast to appropriate type and start using.
Thanks.
Please let me know if anything is not clear.
I have attached the .Net project, .ini file for the custom step and a example sequence file.
09-28-2009 02:53 AM - edited 09-28-2009 02:59 AM
Hello Shivapriya,
The example you've sent doesn't compile. And it without it I'm affraid I do not understand the problem you're describing.
You've given references to libraries that you've not attached with your files.
For the C# I see these are the
IADCore.dll
InstrimentInterfaces.dll
TestStand also seems to want to reach for the assembly named TestSystem.dll.
I can only tell you that I have used successfully in the past the Variables in TestStand to hold .NET object references, and call methods on them and I experienced nothing similar that you describe, but I don't quite follow what is the problem here, as I can't use the example.
I would appriciate if you cold narrow down the example to 1 dll or something where the problem occurs and than resend it.
Regards,
Maciej
10-22-2009 03:55 PM
Currently the .NET adapter treats .NET objects that it stores in Object Reference variables when you specify a .NET module call differently than those set and get using Set/GetValInterface() APIs from within .NET code. It does not work if you set an Object Reference variable with one approach and try to get it with another or vice-versa. It sounds like you set the Object Reference variable from a .NET adapter module call and are then trying to get it using GetValInterface() inside of another call. If so, I'd recommend you instead pass it in as a parameter to the second call rather than using GetValInterface().
Also, keep in mind that object references cannot be saved to disk so it doesn't really make sense to create and store one at edit time. It might be better to store the actual data in the step using variables of the more specific basic types (e.g. String, Number, Boolean).
Hope this helps,
-Doug