dotnet / dotnet/orleans

Orleans 7 - Enums in RequestContext are converted to int

Open
#8,210 2 comments 0 reactions 1 assignee Claimed by @ReubenBond View on GitHub
area-serialization bug Needs: investigation 🔍
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
13h 56m
Merged PRs (30d)
351

Description

It seems there is a regression with enums in the `RequestContext`.

Previously, I had something like this to wrap properties in the `RequestContext`

```csharp
public static OperatingMode OperatingModeFilter
{
get => RequestContext.Get(nameof(OperatingModeFilter)) as OperatingMode? ?? OperatingMode.Maintenance;
set => RequestContext.Set(nameof(OperatingModeFilter), value);
}
```

Where `OperatingMode` is an Enum

As long as I am in the same silo, the value is ok, But when the request is handled by another silo, calling `RequestContext.Get(nameof(OperatingModeFilter))` returns an int, so the safe cast `as OperatingMode?` fails and returns null

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.