Orleans - System.TypeAccessException: Named type "Messages.Example" is invalid: Type string "Message.Example" cannot be resolved.
While debugging an Orleans application, the following exception was thrown:
System.TypeAccessException: Named type "Messages.Example" is invalid: Type string "Messages.Example" cannot be resolved. at Orleans.Serialization.BinaryTokenStreamReader.ReadSpecifiedTypeHeader() at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.BuiltInTypes.DeserializeOrleansResponse(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.SerializationManager.Deserialize(Type t, BinaryTokenStreamReader stream) at Orleans.Serialization.SerializationManager.Deserialize(BinaryTokenStreamReader stream) at Orleans.Runtime.Message.DeserializeBody(List`1 bytes) at Orleans.Runtime.Message.get_BodyObject() at Orleans.Runtime.GrainReference.ResponseCallback(Message message, TaskCompletionSource`1 context) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Orleans.Runtime.GrainReference.d__42`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
The reason is that Orleans is unable to find the serialized object. To fix it I had to add the following line to the Orleans client configuration:
.ConfigureApplicationParts(appParts => appParts.AddApplicationPart(typeof(Messages.Example).Assembly)
Here is the full config: