From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

.net dll causes fatal error within Teststand 2014

We're using doem .net dll's to communicate through RS232 with some instruments. 

But especially when we end a sequence it gives a fatal error and Teststand crashes. This rarely happens while sequence is running. We believe it's s'thing about object handling.

Is there anyone faced and solved such a problem

0 Kudos
Message 1 of 10
(3,905 Views)

Hi Hede,

 

What do you mean be doem .NET dll? Does the dll succesffully communicate with the instrument when you  use it in the development enviroment? 

 

How are you handling the calls to the instrument? 

 

What is the crash that you recieve from TestStand? Does it give you any reasons? Do you have any dump files related to the crash? 

 

0 Kudos
Message 2 of 10
(3,889 Views)

Yes the instrument works well in the development. Find attached the messages when the system crashes. 

We create object reference in Preuutloop and our dll opens comport, applies the communication and closes comport.

The screenshot is attached 

0 Kudos
Message 3 of 10
(3,863 Views)

Hello, 

 

Does this crash occur every time with TestStand? 

 

Does TestStand handle any of the instrument calls or is all done through that .NET dll? 

0 Kudos
Message 4 of 10
(3,853 Views)

This crash occurs 2 different types. On one of the systems it occurs during the test run and cause no interrupt for the system (attached pictures on previous msg is about that one).

Other type occurs when we end or terminate the sequence frequently.

We handle everything within the .net code, we just send some parameters. For example we control 2 devices, one of them is a PSU and we send the Voltage value to be set and the other one is an output module and we set output address and value if it helps.

0 Kudos
Message 5 of 10
(3,849 Views)

Hi

 

I expirience the same symptom with one of my .net dlls.

It happens after 75 tests, or at TS closing.

I found out there is a memory leak within the .dll (some open source c++ code wrapped somehow), eating 20 MB memory pr. test. @1,5GB memory consumption TS crashes.

0 Kudos
Message 6 of 10
(3,836 Views)

When TestStand unloads all .NET references and .NET modules that it is aware of, it unloads the appdomain that it executes .NET code in. From the error messages you are seeing it looks like the .NET module you are calling has a worker thread running and is not ready to be cleaned up. Perhaps an object needs to be disposed first that you might not be calling dispose on? You can also keep teststand from unloading the appdomain, if needed, by keeping a reference to a .NET object in a global variable, such as the station globals. It will however still unload the appdomain when exiting the teststand application, so you might want to see if there is some cleanup required by the .NET assembly that you are missing, which is most likely the cause of the error you are seeing.

 

Hope this helps,

-Doug

0 Kudos
Message 7 of 10
(3,828 Views)

Hi dug900,

Actually i am not very expert at TS. I use file globals for the object reference. so do you resommend to keep object reference at station globals? I almost understood what you mean but couldn't understand what to try exactly?

0 Kudos
Message 8 of 10
(3,795 Views)

@hedehodo wrote:

Hi dug900,

Actually i am not very expert at TS. I use file globals for the object reference. so do you resommend to keep object reference at station globals? I almost understood what you mean but couldn't understand what to try exactly?



Yes, but only really as a workaround. The root cause of the problem is likely either some missing cleanup you need to do for the .NET dll, or an issue with the .NET dll itself.

 

-Doug

0 Kudos
Message 9 of 10
(3,788 Views)

Hi,

I am %100 is sure the problem occurs due to my .net dll which communicate hardwares through RS232

0 Kudos
Message 10 of 10
(3,661 Views)