05-08-2009 07:33 AM
Here's my setup :
TestStand V4.1.1
Visual Basic .NET 2008
.NET Framework 3.5
I'm having a problem where TestStand crash without any warning when trying to transfer an Array object from TestStand to my .NET DLL. Here's the source code of my DLL
Public Class Class1
Public Sub GetArrayOfObject(ByRef Array() As Object)
End SubEnd Class
My sequence only create a .net Object, try to run the function and then do the Cleanup.
1. Is there anything wrong in the way I did it ?
2. How can I unload correctly a .net object, I did Object = nothing in the cleanup, but if I want to compile my .NET dll again, VS 2008 will tell me that the DLL is locked to another application. If I go in TestStand and click on "Unload all modules" it will correctly compile my .net dll.
Thanks.
05-11-2009 11:06 AM
05-11-2009 12:10 PM
Hi,
I do understand that I can pass an array of double or an of string easily from TestStand to .NET, since I already did it. The problem is that now I need to pass an array of object and that TestStand will crash without any warning when doing so.
Did you replicate the crash using the .seq and DLL I've attached to my first post ?
Thanks for your help.
05-12-2009 08:34 AM
Hi,
I apologize for the misunderstanding on my part. You can store an Array of Object types in TestStand and then pass it to a .NET Assembly by creating a reference to the .NET Object and calling the method in the class.
I have created a .NET Assembly that has the following source code:
Public Class Class1
Public Sub PassArrayOfObject(ByRef Array() As Object)
End Sub
End Class
In the Sequence file I am creating two .NET Objects and storing them in ArrayOfObjects, I then create an Object Reference and pass this array to the PassArrayOfObjects method.
Please see the attached example.
-Adri
05-12-2009 02:17 PM
Hi,
thanks for your answer. I did test your example and it seem to work correctly. I still don't understand why the one I've attached to the first post is crashing. Did you test it ?
The only difference is that the Array you are passing is countaining 2 objects and that mine is containing 10 object of "nothing".
I really thinks it's a bug, since TestStand will close withount any error.
Thanks,
05-12-2009 03:09 PM
Hi,
I ran the example code you provided in the TestStand 4.1.1 environment and I could not reproduce the crash. I did receive an error in regards to the object reference not being accessible between application domains, but this could be due to implementation that was built into the Assembly you provided. The implementation that I attached in a previous thread takes advantage of passing an Array of type Object from the TestStand environment to a .NET Assembly as you are wanting.
Please let NI know if you experience this crash with the source I have provided and we can investigate the possibility of a bug.
-Adri K
05-13-2009 09:52 AM
Hi,
I did run again your example but with the two step in the setup section skipped.
The first time I did received an error from TestStand
"An error occurred while releasing the .NET object reference.
Impossible de passer un GCHandle sur des AppDomains.
Nom du paramètre : handle"
So I did try to run it again and then TestStand crashed and close asking me to send informations to Microsoft.
If I reopen TestStand and run the two first step has skipped, sometime it will crash sometime it will not. Could you please test this case and try to replicate this error ?
Also, why is it impossible for TestStand to send an array of Object as Reference so that .Net will filled this array and return it back to TestStand ?
Thanks,
05-14-2009 11:06 AM
Hi,
Did you reproduce the crash with the files I attached or the original example?
-Adri
05-14-2009 11:21 AM
Hi,
I did replicate it with your example when skipping the two first line. Sometime it will tell me an error (see previous post) and sometime it will crash TestStand.
05-15-2009 09:07 AM
Hi,
Could you please indicate why you are skipping the first two lines? These lines are creating obkecteds to be stored in the array.
-Adri K