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.

Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect Msg sent to Actor (Bad Type Cast error). Something to think about…

This may have been discussed, but I couldnt' find anything with a quick search.

If a message intended for Actor A is accidentally sent to Actor B you will get a Bad Type Cast Error.  The issue is with what happens after this Do.vi executes.  The error will exist on the error cluster out.  The Actor out indicator will contain an empty object of the intended actor and NOT the actor object from the control Actor in.  What this effectively does is place an incorrect empty actor object inside the actor core that executed this specific Do.vi.  This cripples the actor which received this message. 

I came across this in my program when I realized I was sending a message to an incorrect actor queue (I found it by visual inspection only). I then questioned why my error routines in Handle Error.vi were not capturing this and bringing it to my attention.  Well if the scenario described above occurs then the wrong Handle Error.vi will execute because the Do.vi switched my actor object.  Plus the actor object that is sent out of the Do.vi is empty so it does NOT have any active data….  WHOOPS!

A simple fix would be to update the Do.vi template so the Actor In object is sent to the Actor out object when an error occurs on the To More Specific Class function .  This would allow the actor to handle the error accordingly.

Do.vi.jpg

0 Kudos
Message 1 of 6
(5,502 Views)

This will be fixed going forward.  For now, you can modify Do.vi in the message template.  The template is at <LabVIEW 2011>\project\_Message Maker\_templates\Message Template.

Message 2 of 6
(3,230 Views)

Excellent! Just to clarify, does "going forward" mean AF 2012, or a version sometime after that? (I'd like to know for revision planning.)

0 Kudos
Message 3 of 6
(3,230 Views)

And is the fix along the order of this?...

http://forums.ni.com/t5/LabVIEW/Performance-tweak-for-LV-Classes-and-quot-To-More-Specific-quot/m-p/...

Basically it is an atempt to cast (To More Specific).  If fail, then use original object, otherwise, use the 'cast' object.

0 Kudos
Message 4 of 6
(3,230 Views)

David: LV 2012 with AF 4.0 aka August

Kurt: Yes.

0 Kudos
Message 5 of 6
(3,230 Views)

I faced this issue recently, and thought it would be useful to add that messages generated in previous versions of LV2012's Actor Framework need to be re-generated in order to fix the issue!.

0 Kudos
Message 6 of 6
(3,230 Views)