BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Control references and sequence structures

My supervisor and I were discussing one of his programs, and he asked me if I knew why he kept getting "Object reference is invalid" on a property node that was using a reference.  I couldn't figure it out either, and eventually I said to try moving the actual control itself (on the block diagram), into the first pane of the sequence structure, and just feed the wire through.

This solved all of our problems...  however both of us were stumped with why what I suggested actually made it work.  Anyone know why this is?

Oops...  I just realized that I made this on the breakpoint board instead of the LabVIEW board...sorry.  Although I suppose that the people who frequent this might be the best to answer this...

Message Edited by Novatron on 07-14-2005 05:24 PM

0 Kudos
Message 1 of 7
(6,359 Views)

I don't understand the connection you're making between the control's reference and its terminal. Are you refering to the Value property?

You're saying you moved the terminal into the first frame and wired it through. Into what? The property node wouldn't accept it as a reference. And in any case, the terminal's location should not affect the program in the sense that the program will run anyway.

You were probably getting the error from trying to get to an object which doesn't exist (like plot #4 on a graph with only 3 plots).

How about posting the relevant code with remarks about what exactly was changed?

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(6,353 Views)
I apologize for the confusion.

Hopefully the image will clear things up.  The object does exist, and everything is peachy in the "Works" part, but if I try and run something with the "Does not work" format, I get the "Object Reference is Invalid" error.
0 Kudos
Message 3 of 7
(6,341 Views)

As far as I can tell, the only possible difference between those two pieces is if you somehow give the reference a value in the first frame. Other than that case, they should be identical, barring any other alternatives I can't think of.

We will need some actual code we can play with to see what you're saying.


___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(6,336 Views)

There should be no difference between the two code versions IF you adhere to proper dataflow.

(Of course it is conceivable that the program is a mess and there is a race condition, e.g. if the reference is initially invalid and you set it elsewhere in the code via e.g. a local variable of the reference. In this case, a subtle change (e.g. the sequence structure) can rearrange the execution order for it to suddenly work by accident.)

I would be very curious to see a working example that demonstrates your described behavior. 🙂

0 Kudos
Message 5 of 7
(6,317 Views)
Ahhh, I wish I could post the code, however my supervisor is uncomfortable with that, as it contains some sensitive customer information.

I tried to make a mock up vi with the same functionality, but unfortunately (or fortunately...depending on how you look at it) it worked both ways, so it must be about the way the vi in question was written. 

I know for a fact that there are no race conditions, as this is

a) the only reference in the vi
b) only used once
c) not altered or modified in any way (the reference itself)

If I end up figuring out what the problem is, or what was causing that behavior, I'll post it here.  Thanks for taking a look at this though!!
Message 6 of 7
(6,305 Views)

A couple of points:

Is this a subVI? Are you getting the reference from a calling VI?

What object does the reference point to? This may give us a clue.

You can test (and potentially release) this, if you make a copy of the non-working version and start deleting pieces of the code until it works. Then, you can probably understand where at least some of the problem originates.


___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(6,277 Views)