NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand Crashing with .net Array of object

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 Sub

End 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.

  

Download All
0 Kudos
Message 1 of 19
(4,675 Views)
Hi,

Passing an Array from TestStand to a .NET DLL can be done much easier than creating and passing an Object Reference that you manually create. TestStand can create the class object for you and pass the array data to the .NET DLL as a parameter.

I have attached an example sequence file and a modified DLL. The DLL source has the following implementation:

Public Class Class1
    Public Sub GetArrayOfObject(ByRef Array() As Double)
    End Sub
End Class


-Adri K
Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 2 of 19
(4,632 Views)

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.

0 Kudos
Message 3 of 19
(4,628 Views)

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

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 4 of 19
(4,605 Views)

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,

0 Kudos
Message 5 of 19
(4,596 Views)

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

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 6 of 19
(4,591 Views)

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,

 

 

0 Kudos
Message 7 of 19
(4,578 Views)

Hi,

 

 Did you reproduce the crash with the files I attached or the original example?

 

-Adri

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 8 of 19
(4,569 Views)

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.

0 Kudos
Message 9 of 19
(4,567 Views)

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

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 10 of 19
(4,559 Views)