79490889

Date: 2025-03-06 23:12:52
Score: 1
Natty:
Report link

By configuring Orleans to serialize also CancellationTokens with System.Text.Json, I made the webapplication version work and also produce the expected output.
For that the nuget package Microsoft.Orleans.Serialization.SystemTextJson must be installed.

builder
    .UseOrleans(siloBuilder =>
    {
        siloBuilder.UseLocalhostClustering();
        siloBuilder.Services.AddSerializer(serializerBuilder =>
        {
            serializerBuilder.AddJsonSerializer(isSupported: typeCand => typeCand == typeof(System.Threading.CancellationToken));
        });
    });

More details and other approaches can be found in the docs (https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/serialization-configuration?pivots=orleans-7-0#configure-orleans-to-use-systemtextjson).

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: david-1160