You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in Orleans.Serialization.Serializers.CodecProvider.cs on lines 495-507:
private IFieldCodec CreateCodecInstance(Type fieldType, Type searchType)
{
if (searchType == ObjectType)
return _objectCodec;
object[] constructorArguments = null;
if (_fieldCodecs.TryGetValue(searchType, out var codecType))
{
if (codecType.IsGenericTypeDefinition)
{
codecType = codecType.MakeGenericType(fieldType.GetGenericArguments());
}
//...
this throws an exception if the codec type's arity and the field type's arity aren't matching.
In our concrete case the field type inherits from Collection<>, no codec is found (we use json serialization) and a search with the base type is conducted on CodecProvider.cs line 546. Then on line 505 the following error is thrown:
System.ArgumentException: The number of generic arguments provided doesn't equal the arity of the generic type definition. (Parameter 'instantiation').
Solution would be in my opinion to only enter the if branch if the arity matches, i.e.
Orleans version: 9.0.1
in Orleans.Serialization.Serializers.CodecProvider.cs on lines 495-507:
this throws an exception if the codec type's arity and the field type's arity aren't matching.
In our concrete case the field type inherits from Collection<>, no codec is found (we use json serialization) and a search with the base type is conducted on CodecProvider.cs line 546. Then on line 505 the following error is thrown:
System.ArgumentException: The number of generic arguments provided doesn't equal the arity of the generic type definition. (Parameter 'instantiation').
Solution would be in my opinion to only enter the if branch if the arity matches, i.e.
Since there is no guarantee, that the base type's arity is equal to the inheriting type's. But im not entirely sure.
As far as i could descern this problem is also related to #8817 and #8347
The text was updated successfully, but these errors were encountered: