05-15-2009 09:13 AM
Hi,
I'm skipping the first two line since I want to send an empty array to my .NET dll. The DLL will then stored information in this empty array and return it (BYREF) to TestStand.
Thanks
05-18-2009 09:54 AM
Hi,
These first two lines are creating dummy references. You can use these dummy object references and pass these values in the array. This does not cause the crash. With this implementation you can then incorporate the functionality you are wanting with logic in the DLL.
-Adri K
05-19-2009 07:36 AM
Ok,
but is it normal that TestStand will sometime crash when skipping those two lines ? Did you replicate this problem ?
Thanks,
05-20-2009 09:12 AM
Hi,
Yes I did replicate the crash when skipping the first two lines. The workaround to avoid this crash is to use those two lines and pass dummy references.
-Adri K
06-25-2009 07:07 AM
HI all,
I have similar problem. In our factory we using teststand and our sequencer.We have a lot of different hardware so we made something like HW manager.It is done in C#.For future use we created something like General function call :
bool general_function(string function_name, object[] parameters, object[] results)
with this we call any function in our HW manager from sequencer.But TS crashing all the time when we call this function.Sometimes we get a message that is not possible to pass object between app. domains.So my question is similar at on beginig of this thread : how we can pass something without some knowledge about called function?For example i will put as function_name same name of function,as parameters i would like to pass array of numbers packed to the object and as result i will get array of numbers packet to object.If i will call some other function i will pass different parameters.Our HW manager takes this parameters and he casting parameters based on function name ,becouse he know what kind of parameters should be inside.I read that this can by done by .NET remoting but we want to avoid this if it is possible.
Im sorry that i interrupting this thread and for my english.
06-25-2009 12:00 PM
It sounds to me like the crash only occurs if the array you are passing contains null/nothing objects in it. Perhaps as a workaround you could assign a temporary .net object to elements that would otherwise be set to Nothing.
Hope this helps,
-Doug
06-25-2009 08:29 PM
Hi doug,
Thanks for answear, i found some functions with some null pointer on the end of array.Now testand gets exception every time a call extra function.I attached a example of simple extra function call and error message.Could you look at that please?
regards,
06-26-2009 10:44 AM - edited 06-26-2009 10:51 AM
There is a similar related problem that we are also looking into. When you assign an array of numbers to an element of the array of object references what you are doing is really assigning an ActiveX reference of the TestStand PropertyObject which represents the array to the array of object references. Passing an ActiveX reference inside an array of object references currently has this issue (we are looking into it), but is also probably not what you intended to do in the first place. You probably wanted to pass a dotnet array of numbers for that element instead.
In order to do this you will need to write and call a utility function as follows to convert an array of numbers into a dotnet object for TestStand.
public void ReturnArrayAsDotnetArray(double[] intput, out object arrayOfNumbersAsDotNetObject)
{
arrayOfNumbersAsDotNetObject = intput;
}
Then in your sequence you can call this function to get a dotnet object version of the array, and then assign that to your array of object references.
Here's a TestStand 4.1 example sequence of doing this:
Hope this helps,
-Doug
06-26-2009 11:34 PM
Hi Doug,
Thanks for explanation.It was really helpful.I created some conversing functions and it works great!!
Thanks so much.