akkadotnet / akkadotnet/Akka.Serialization.MessagePack

Failed serialize XmlCDataSection

Open
#107 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
15
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hello, I have a message like:

```
[System.Reflection.Obfuscation]
[Serializable, XmlRoot("ExecuteScript")]
public class RemoteScript : BaseXmlMessage
{
...
private string _Script;

[XmlElement("Script")]
public XmlCDataSection Script
{
get
{
return new XmlDocument().CreateCDataSection(_Script);
}
set
{
_Script = value.Value;
}
}
...
}
```

But when I send it message to Akka system the serializer send me this error:

```
Failed to write message [RemoteScript] to the transport

Cause: Akka.Remote.EndpointException: Failed to write message [RemoteScript] to the transport
---> MessagePack.MessagePackSerializationException: Failed to serialize FlexxAgent.Execution.Core.Execution.Command value.
---> MessagePack.Internal.MessagePackDynamicObjectResolverException: can't find matched constructor. type:System.Xml.XmlCDataSection
at MessagePack.Internal.ObjectSerializationInfo.CreateOrNull(Type type, Boolean forceStringKey, Boolean contractless, Boolean allowPrivate)
at MessagePack.Internal.DynamicObjectTypeBuilder.BuildType(DynamicAssembly assembly, Type type, Boolean forceStringKey, Boolean contractless, Boolean allowPrivate)
at MessagePack.Resolvers.DynamicObjectResolver.BuildFormatterHelper[T](IFormatterResolver self, DynamicAssemblyFactory dynamicAssemblyFactory, Boolean forceStringKey, Boolean contractless, Boolean allowPrivate)
at MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.FormatterCache`1..cctor()
--- End of stack trace from previous location ---
at MessagePack.FormatterResolverExtensions.Throw(TypeInitializationException ex)
at MessagePack.Formatters.FlexxAgent_Communication_Workspaces_Data_Pop_RemoteOperationFormatter20.Serialize(MessagePackWriter& writer, RemoteOperation value, MessagePackSerializerOptions options)
at Akka.Serialization.MessagePack.Resolvers.PolymorphicFormatter`1.Serialize(MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at MessagePack.Formatters.FlexxAgent_Communication_Workspaces_Commands_RemoteOperationCommandMessageFormatter19.Serialize(MessagePackWriter& writer, RemoteOperationCommandMessage value, MessagePackSerializerOptions options)
at Akka.Serialization.MessagePack.Resolvers.PolymorphicFormatter`1.Serialize(MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at MessagePack.Formatters.TypelessFormatter.Serialize(MessagePackWriter& writer, Object value, MessagePackSerializerOptions options)
at MessagePack.Formatters.ForceTypelessFormatter`1.Serialize(MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at MessagePack.Formatters.FlexxAgent_Execution_Core_Execution_CommandFormatter18.Serialize(MessagePackWriter& writer, Command value, MessagePackSerializerOptions options)
at Akka.Serialization.MessagePack.Resolvers.PolymorphicFormatter`1.Serialize(MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
--- End of inner exception stack trace ---
at MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at lambda_method395(Closure, Object, MessagePackSerializerOptions, CancellationToken)
at MessagePack.MessagePackSerializer.Serialize(Type type, Object obj, MessagePackSerializerOptions options, CancellationToken cancellationToken)
at Akka.Serialization.MessagePack.MsgPackSerializer.ToBinary(Object obj)
at Akka.Remote.MessageSerializer.Serialize(ExtendedActorSystem system, Information transportInformation, Object message)
at Akka.Remote.EndpointWriter.WriteSend(Send send)
--- End of inner exception stack trace ---
at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level, Boolean needToThrow)
at Akka.Remote.EndpointWriter.WriteSend(Send send)
at Akka.Remote.EndpointWriter.b__28_0(Send s)
at lambda_method133(Closure, Object, Action`1, Action`1, Action`1)
at Akka.Actor.ReceiveActor.OnReceive(Object message)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)
```

SAlu2s

Contributor guide

Open the contributing guide

Research direction

Start with the RemoteScript.Script property and the MessagePack serialization stack shown in the error, then reproduce sending a RemoteScript through the Akka system. Check how XmlCDataSection is handled; done means the message serializes and is sent without the reported constructor exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.