Skip to content

Not working with Enum types #16

@tmenezes

Description

@tmenezes

Could not get it to work with enum types. Perhaps missing how the setup is done for enums...
Also the two different serializers part adds up complexity making it difficult to understand when to use what.

Stacktrace:

System.ArgumentException: Object of type 'System.String' cannot be converted to type 'Some.Namespace.Models.MyEnum'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(StackAllocedArguments& stackArgs, ReadOnlySpan`1 parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeOneParameter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FillProperties[T](TableEntity entity, T o, List`1 properties, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FromTableEntity[T,TP,TR](TableEntity entity, Expression`1 partitionProperty, Func`2 convertPartitionKey, Expression`1 rowProperty, Func`2 convertRowKey, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FromTableEntity[T,TP,TR](TableEntity entity, Expression`1 partitionProperty, Expression`1 rowProperty, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.POCO.SimpleKeysConverter`3.FromEntity(TableEntity entity)
   at TableStorage.Abstractions.POCO.PocoTableStore`3.CreateRecord(TableEntity entity)

Info: The column in the Table Storage for the enum property is type string and was added manually

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions