This project is read-only.
1
Vote

Avro serialization throw error for enumberation with duplicated value like (HttpStatusCode)

description

just create one class with one member as HttpStatusCode, and try to serialize it, you'll get below error because HttpStatusCode have defined duplicated value.

Result Message:
Assert.Fail failed. AccessDeniedException failed:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Hadoop.Avro.Schema.EnumSchema..ctor(NamedEntityAttributes namedEntityAttributes, Type runtimeType, Dictionary
2 attributes)
at Microsoft.Hadoop.Avro.Schema.ReflectionSchemaBuilder.BuildEnumTypeSchema(Type type, Dictionary2 schemas)
at Microsoft.Hadoop.Avro.Schema.ReflectionSchemaBuilder.AddRecordFields(IEnumerable
1 members, Dictionary2 schemas, UInt32 currentDepth, RecordSchema record)
at Microsoft.Hadoop.Avro.Schema.ReflectionSchemaBuilder.BuildRecordTypeSchema(Type type, Dictionary
2 schemas, UInt32 currentDepth)
at Microsoft.Hadoop.Avro.Schema.ReflectionSchemaBuilder.CreateNullableSchema(Type type, Dictionary`2 schemas, UInt32 currentDepth)
at Microsoft.Hadoop.Avro.Schema.ReflectionSchemaBuilder.BuildSchema(Type type)
at Microsoft.Hadoop.Avro.AvroSerializer.CreateForCore[T](String writerSchema, AvroSerializerSettings settings)
at Microsoft.Hadoop.Avro.AvroSerializer.Create[T](AvroSerializerSettings settings)

comments