dapr / dapr/dotnet-sdk

Actor serialization doesn't work as dapr client

Open
#1,050 1 comment 0 reactions 0 assignees View on GitHub
area/actor kind/bug
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

I am using custom System.Text.Json converters in my dapr application. I set the serialization options to the same value for both dapr client and actors
```
builder.Services
.AddControllers()
.AddDapr(fun daprClientBuider -> daprClientBuider.UseJsonSerializationOptions(App.JsonSerializationOptions) |> ignore)

builder.Services.AddActors(fun actorRuntimeOptions -> actorRuntimeOptions.JsonSerializerOptions <- App.JsonSerializationOptions)
```
DaprClient calls work as expected with the custom converters
## Expected Behavior
Actor calls should also feature the custom converters
## Actual Behavior
Actor calls throw serialization exception
```
System.Runtime.Serialization.SerializationException: Type 'Yatp.Domain.CardValue+Grid' with data contract name 'CardValue.Grid:http://schemas.datacontract.org/2004/07/Yatp.Domain' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.