akkadotnet / akkadotnet/Hyperion
NullReferenceException throws when serializing a JObject
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 281
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
When JObject is used for messaging then Akka fails to route such messages due to serialization problem.
In my particular case I have a strong typed message class with `IDictionary` property and `Akka.Serialization.Hyperion` configured as default serializer. At some moment this dictionary may contain JObject. Such messages destroy actor life-cycle due to serialization problem.
I made a test project to illustrate such behavior
[JObjectSerializationTest.zip](https://github.com/akkadotnet/Hyperion/files/1232008/JObjectSerializationTest.zip)
```
System.NullReferenceException: Object reference not set to an instance of an object.
at Hyperion.SerializerFactories.DictionarySerializerFactory.<>c__DisplayClass3_0.b__1(Stream stream, Object obj, SerializerSession session)
at Akka.Serialization.HyperionSerializer.ToBinary(Object obj)
at JObjectSerializationTest.UnitTest.<>c__DisplayClass1_0.b__0(Serializer serializer, Object entity)
```
Used packages versions
```
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the attached JObjectSerializationTest project, then inspect DictionarySerializerFactory.BuildSerializer and the Akka.Serialization.HyperionSerializer.ToBinary call shown in the stack trace. Use UnitTest.ShouldBeSerializedByHyperion as the starting test; done means the dictionary containing a JObject serializes without a NullReferenceException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100