Migrating from v3 to v7 results in RequiredFieldMissingException - Serialized value is missing its type field
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 354
Description
I have a heterogeneous Orleans cluster running well in version 3.6.5. Now I am trying to upgrade it to Orleans v7.2.3. and encoutnered the following error when calling `ICurrencyGrain.Subscribe` method
```
Orleans.Serialization.RequiredFieldMissingException
HResult=0x80131500
Message=Serialized value is missing its type field.
Source=Orleans.Serialization
StackTrace:
at Orleans.Serialization.Invocation.ResponseCompletionSource`1.GetResult(Int16 token)
at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
```
Here are source code of grains definition. If I drop the interfaces(ICurrencyGrain/ICurrency) and use concrete types instead, the issue disappears. The same code run well in version 3.6.5. Unsure why it failed in such way.
```csharp
public interface ICurrencyGrain : IGrainWithStringKey
{
Task> Subscribe(ICurrencyObserver observer, long currencySetID = 0);
}
[GenerateSerializer]
public class CurrencySet : ICurrencySet
{
[Id(0)]
public long Seq { get; set; }
[Id(1)]
public IDictionary CurrencyMap { get; } = new Dictionary();
}
[GenerateSerializer]
public class Currency : ICurrency
{
[Id(0)]
public string Code { get; set; } = string.Empty;
[Id(1)]
public CurrencyType Type { get; set; }
[Id(2)]
public int DecimalPlaces { get; set; }
[Id(3)]
public IDictionary RateMap { get; set; } = new Dictionary();
}
[GenerateSerializer]
public enum CurrencyType
{
Fiat,
Crypto,
}
public interface ICurrency
{
string Code { get; }
CurrencyType Type { get; }
int DecimalPlaces { get; }
IDictionary RateMap { get; set; }
}
public interface ICurrencySet
{
long Seq { get; }
IDictionary CurrencyMap { get; }
}
```
Contributor guide
Research direction
Reproduce the `ICurrencyGrain.Subscribe` call during the v3.6.5-to-v7.2.3 migration using the shown interface-based `CurrencySet` and `Currency` types, then compare it with the concrete-type version that succeeds. Investigate Orleans serialization of the interface-valued `CurrencyMap` and the resulting `RequiredFieldMissingException`; done when the migrated heterogeneous cluster can complete the call without that exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100