dotnet / dotnet/orleans

F# Discriminative Unions not serializing correctly when being returned from grains

Open
#9,258 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
14h 42m
Merged PRs (30d)
354

Description

I believe there is an issue with the fsharp discrimitive unions and the orleans dotnet 9 grain serializer

Here is a repo were this can be reproduced
https://github.com/WesleySkeen/orleans-fsharp-dotnet9/tree/main

I have this type that gets returned from the grain

![Image](https://github.com/user-attachments/assets/bd493c23-fd8c-4768-8eb7-7e669dc42a1b)

Here is the grain interface and its implementation

![Image](https://github.com/user-attachments/assets/454c317c-da91-4f78-a9e1-6ff8733e8855)

I have hardcoded the result to demonstrate the issue.

I believe the issue lies in the `responseCopier` of the `GrainMethodInvoker` class

Here is the response before the `responseCopier` function gets called

![Image](https://github.com/user-attachments/assets/c8e50282-9114-4684-ae09-71e39cb4cb96)

and here is the result after

![Image](https://github.com/user-attachments/assets/816cbcf2-d959-497e-901a-70d4e5dc6231)

As you can see, the content of the discrimitive union is now null

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction repository and inspect GrainMethodInvoker, focusing on the responseCopier path described in the report. Reproduce the grain call with the discriminated-union response, compare the value before and after copying, and consider the issue complete when the returned union retains its content.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, fsharp
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.