LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't delete C# object when stopping VI

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

 

I am using a thread in my C# app that I backgrounded, and I'm opening files.

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

 

I am using a thread in my C# app that I backgrounded, and I'm opening files.

 

When I click "Stop" it leaves the files open, and when I click start again it makes more.

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

 

I am using a thread in my C# app that I backgrounded, and I'm opening files.

 

When I click "Stop" it leaves the files open, and when I click start again it makes more.

 

**What can I do to make sure Labview deletes my C# class upon completion or stopping?**

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

 

I am using a thread in my C# app that I backgrounded, and I'm opening files.

 

When I click "Stop" it leaves the files open, and when I click start again it makes more.

 

**What can I do to make sure Labview deletes my C# class upon completion or stopping?**

 

In addition, as it stands, the system creates more and more cruft, creating several copies of my class until I restart all of labview.

I'm having some trouble with labview and bringing in my C# interface.  I can load it and use it just fine, however, when I click "Stop" Labview takes a few moments to actually respond and stop.

 

 

Before I set my threads to be background, Labview would completely freeze and lock up then crash.

 

I am using a thread in my C# app that I backgrounded, and I'm opening files.

 

When I click "Stop" it leaves the files open, and when I click start again it makes more.

 

**What can I do to make sure Labview deletes my C# class upon completion or stopping?**

 

In addition, as it stands, the system creates more and more cruft, creating several copies of my class until I restart all of labview.

 

Any help would be greatly appreciated,

Charles

0 Kudos
Message 1 of 4
(2,772 Views)

It appears that your browser is also having problems!

 

When you say you "click stop" do you mean a programmatic stop in a loop or whatever, or do you mean the "stop sign" in the LabVIEW toolbar? If it is the later then you are probably not performing the proper clean up. I don't know how your C# objects are called, but in our project using .NET components I have a call that produces a reference, the reference is used by various calls to the methods, then I have a discrete close that signals the .NET to dispose. If I used the "stop sign" to stop the close would occur and resources would probably be left open.

 

As another poster says in his signature (I'm paraphrasing)  "Using the stop button is like using a tree to stop your car, it works, but isn't recommended"  Sorry for the misquote!

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 4
(2,768 Views)

I'm also not sure what you mean by "backgrounded" but if it is similar to "thread safe" then that could explain why LabVIEW behaved poorly before. If library calls are to .dll's that are not "thread safe" (written to allow running in any thread) LabVIEW runs them in the LabvIEW user interface thread. If they are the type of call that doesn't return for a while (which writting multiple files might do) then the LabVIEW user interface thread will freeze, waiting for them. There are probably other ramifications that aren't coming to mind at the moment, I'm driving an 18 wheeler and trying to text this on my Droid. Just kidding, about the driving/texting,  it has been a long day of meetings.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 4
(2,766 Views)

1) It looks like I do have some browser problems.  That was on FireFox 4.  I'm posting this from Chrome.  Is it possible to edit one's post?

 

2) When in early and mid stages of prototyping, what is the preferred method for debugging?  That stop sign on the toolbar seems critical to being able to go and modify your VI.  It seems like a bug that there isn't any good way to make Labview clean up something that is ref counted anyway.

 

3) Even when I attempted to properly dispose of the .NET component using the Close Reference Object, I was still having some trouble getting it to be called at the right time.  Is there any way to "force" a portion of a VI to get executed upon stopping?

 

4) Backgrounding is just a term that's used in the C# thread model.  If a thread is not backgrounded, then it can prevent process termination and will block until the thread quits - this can be a big problem if your thread never gets the message to quit.  

 

5) Do you think it would be feasible to make this C# class into a singleton?  That way if I try to create multiple instances, it will simply say "oh here's the old one?"

0 Kudos
Message 4 of 4
(2,759 Views)