In .NET 7.0 or later an operation on an actor invoked using a weakly-typed actor client should support a polymorphic response. The response json should include a type discriminator property to allow for polymorphic deserialization by the actor client. The weakly-typed actor client must polymorphically deserialize the response when invoking InvokeMethodAsync<ResponseBase> on the weakly-typed actor client. This should yield a DerivedResponse instance. Note that invoking InvokeMethodAsync<DerivedResponse> is not polymorphic deserialization.
An operation on an actor invoked using a weakly-typed actor client should support a null response.
Actual Behavior
The response json does not include a type discriminator. The deserialized response is an instance of the base response class, not the derived response class.
A null reference exception is thrown by the ActorManager.DispatchWithoutRemotingAsync method.
Steps to Reproduce the Problem
Declare an operation on an actor interface whose declared return type is a base class called ResponseBase. Implement the operation on an actor. The implementation returns an instance of a derived class called DerivedResponse. Invoke the operation using a weakly-typed actor client using the InvokeMethodAsync<ResponseBase> method (not using InvokeMethodAsync<DerivedResponse>).
Return null from an actor operation invoked using a weakly-typed actor client.
Release Note
RELEASE NOTE: Weakly-typed actor supports polymorphic response in .NET 7 or later.
RELEASE NOTE: Weakly-typed actor supports null response.
Expected Behavior
InvokeMethodAsync<ResponseBase>
on the weakly-typed actor client. This should yield aDerivedResponse
instance. Note that invokingInvokeMethodAsync<DerivedResponse>
is not polymorphic deserialization.Actual Behavior
ActorManager.DispatchWithoutRemotingAsync
method.Steps to Reproduce the Problem
ResponseBase
. Implement the operation on an actor. The implementation returns an instance of a derived class calledDerivedResponse
. Invoke the operation using a weakly-typed actor client using theInvokeMethodAsync<ResponseBase>
method (not usingInvokeMethodAsync<DerivedResponse>
).Release Note