Actor Framework Discussions

Showing results for 
Search instead for 
Did you mean: 

Error 1057 occurred in Send Msg at : To More Specific Class

Go to solution

I have two Actors, ActorBListOfActors and ActorA.


ActorBListOfActors holds an array of class ActorFramework:Message Queue.


I have a test vi in which ActorA is launched, and message Send UpdateActor is sent to it. This works as expected.


In the same test vi, another copy of  ActorA is launched, and its Message Queue is added to an array. ActorBListOfActors is launched, and and message Send UpdateActorAList is sent to it. Send UpdateActorAList  accepts as a message the array of ActorA's Message Queue.


So to clarify, ActorA works just fine. ActorBListOfActors launches, its message, Send UpdateActorAList  works. This message then sends the Send UpdateActor  message to the contained array of ActorA message queues.


At the call to Send UpdateActor, an error is thrown. "Error 1057 occurred at To More Specific Class  : Type mismatch: Object cannot be cast to the specified type."


I've tried to trace the error deeper than the call to Send Update Actor. I've added breakpoints to the of the message, and even to ActorA's None of them are ever hit. Why is the Send Msg call throwing error 1057?


I'm trying to recreate similar functionality to the Work Dispatcher.lvclass within the Actor Framework Fundamentals Example project, but with an array of Message Queues instead of a Queue of Message Queues. 


Any help is appreciated!

0 Kudos
Message 1 of 3


It should be noted that ActorBListOfActors doesn't contain simply an array of Actor Message Queues - it contains an event, where the event's data is the Array of Actor Message Queues. When the event is raised, the ActorBListOfActors iterates through the array of actors wired in from the dynamic event node, and sends its message that way.


It should also be noted that when I first wired in the dynamic event, the event's data wasn't showing in the event structure. I had to create a second copy of the event with the same name to force the event data. 


I replaced the Queue logic from the Actor Framework Fundamentals with arrays to test that the array wasn't the problem. I think the issue is more to due with passing the array as an event.


So, an update to my question:

Why does passing an array of message queues as an event appear to cause so many issues? When first registering for the event and wiring it into the event structure's dynamic event terminal, the event data was not available as a selection. I had to create a copy of the event, wire it into the terminal under the same name, then delete the "dummy" copy. I'm wondering if this way of forcing the event data is what's causing an issue when sending my message, so I'll just have the class keep the actors as an array, and provide messages to update the array before iterating through them and sending messages to the actors. But my question still stands unresolved.


0 Kudos
Message 2 of 3
Accepted by topic author AllisonSCJ

Further information, simply because this question requires a solution.


The basic issue here is that wiring an event refnum from an unbundled class unto the register for events property node, and then wiring the resultant registration refnum into the dynamic events terminal of an event structure appears to cause issues. If the event data type is more complex than the normal integer, boolean, etc, I would highly recommend the following:


Create a seperate vi which excepts the class as an input, and handles the event registration, returning the event registration refnum. This appears to clear up data type issues, because the type is identified via the output node of the vi.


Note that Labview appears to have issues with the data type in the event registration refnum prior to runtime, when registering from the class's unbundled private data.

0 Kudos
Message 3 of 3