dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.12k stars 340 forks source link

Exception running Actor example: Type 'Dapr.Actors.Runtime.ActorReminder' cannot be serialized. #1177

Closed m3nax closed 1 year ago

m3nax commented 1 year ago

Expected Behavior

The var reminder = await proxy.GetReminder(); should return the registerd reminder information

Actual Behavior

Exception is thrown in the client: Type 'Dapr.Actors.Runtime.ActorReminder' cannot be serialized. At line https://github.com/m3nax/dapr-dotnet-sdk/blob/master/examples/Actor/ActorClient/Program.cs#L100

Client output:

Making call using actor proxy to save data.
Making call using actor proxy to get data.
Received data is PropertyA: ValueA, PropertyB: ValueB.
Making calls to an actor method which has no argument and no return type.
Got Incorrect Exception from actor method invocation. Exception Dapr.Actors.ActorInvokeException: The method or operation is not implemented.
Making calls without Remoting.
Registering the timer and reminder
Waiting so the timer and reminder can be triggered
Making call using actor proxy to get data after timer and reminder triggered
Received data is PropertyA: Timer triggered at '02023-10-25T22:50:16', PropertyB: Reminder triggered at '2023-10-25T22:50:12'.
Getting details of the registered reminder
Unhandled exception. Dapr.Actors.ActorMethodInvocationException: Remote Actor Method Exception,  DETAILS: Exception: InvalidDataContractException, Method Name: ThrowInvalidDataContractException, Line Number: 0, Exception uuid: 99272412-891a-40e7-9705-1cb6b3edf4e3
 ---> Dapr.Actors.ActorInvokeException: Type 'Dapr.Actors.Runtime.ActorReminder' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.
   --- End of inner exception stack trace ---
   at Dapr.Actors.DaprHttpInteractor.InvokeActorMethodWithRemotingAsync(ActorMessageSerializersManager serializersManager, IActorRequestMessage remotingRequestRequestMessage, CancellationToken cancellationToken) in C:\Users\manue\source\repos\dapr-dotnet-sdk\src\Dapr.Actors\DaprHttpInteractor.cs:line 174
   at Dapr.Actors.Communication.Client.ActorRemotingClient.InvokeAsync(IActorRequestMessage remotingRequestMessage, CancellationToken cancellationToken) in C:\Users\manue\source\repos\dapr-dotnet-sdk\src\Dapr.Actors\Communication\Client\ActorRemotingClient.cs:line 47
   at Dapr.Actors.Client.ActorProxy.InvokeMethodAsync(Int32 interfaceId, Int32 methodId, String methodName, IActorRequestMessageBody requestMsgBodyValue, CancellationToken cancellationToken) in C:\Users\manue\source\repos\dapr-dotnet-sdk\src\Dapr.Actors\Client\ActorProxy.cs:line 227
   at Dapr.Actors.Client.ActorProxy.ContinueWithResult[TRetval](Int32 interfaceId, Int32 methodId, Task`1 task) in C:\Users\manue\source\repos\dapr-dotnet-sdk\src\Dapr.Actors\Client\ActorProxy.cs:line 291
   at ActorClient.Program.Main(String[] args) in C:\Users\manue\source\repos\dapr-dotnet-sdk\examples\Actor\ActorClient\Program.cs:line 100
   at ActorClient.Program.<Main>(String[] args)

Steps to Reproduce the Problem

Release Note

RELEASE NOTE:

philliphoff commented 1 year ago

/assign