royale-asjs icon indicating copy to clipboard operation
royale-asjs copied to clipboard

Incorrect Message type cast by compiler.

Open roboticavicensvives opened this issue 4 years ago • 1 comments

When using a BlazeDS backend and mx:RemoteObjects if there is reference to org.apache.royale.net.remoting.messages anywhere in the codebase such as having in a component :

import org.apache.royale.net.remoting.messages.ErrorMessage;

The compiler converts all mx.messaging.messages.AcknowledgeMessage received from the server to org.apache.royale.net.remoting.messages.AcknowledgeMessage. Then during runtime the an error is thrown within the "NetConnectionChannel.js" file line 434.

if (org.apache.royale.utils.Language.is(msg, mx.messaging.messages.AsyncMessage)) {

as msg is now a org.apache.royale.net.remoting.messages.AcknowledgeMessage instead of a mx.messaging.messages.AcknowledgeMessage

this causes the else condition (line 446) to trigger and return a mx.FaultEvent.

Removal of any reference to org.apache.royale.net.remoting.messages fixes the issue. But the error message:

Was expecting mx.messaging.messages.AcknowledgeMessage, but received

org_apache_royale_net_remoting_messages_AbstractMessage__body

Doesn't really reflect the reason this is occurring, as you could have (as I did) the reference in a Visual component.

roboticavicensvives avatar Apr 06 '21 12:04 roboticavicensvives

Do you have a small test case which shows the issue?

Harbs avatar Apr 06 '21 16:04 Harbs