neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.36k stars 266 forks source link

System.ArgumentException: Key was already exists. Serializing my class #91

Open Miro382 opened 6 years ago

Miro382 commented 6 years ago

Hi, I receiving this exception when I try serialize my custom class: Exception thrown: 'System.ArgumentException' in Utf8Json.dll System.ArgumentException: Key was already exists. Key:System.Byte[] at Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify[T](IJsonFormatterResolver resolver) at Utf8Json.Formatters.Good_Teacher_DataStoreFormatter1.Serialize(JsonWriter& , DataStore , IJsonFormatterResolver ) at Utf8Json.JsonSerializer.ToJsonString[T](T value, IJsonFormatterResolver resolver) at Utf8Json.JsonSerializer.ToJsonString[T](T value)

Thanks

OlegNadymov commented 6 years ago

I have similar problem. Any ideas? My stack trace:

  at Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify[T](IJsonFormatterResolver resolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , ConstructorInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Utf8Json.Formatters.CollectionFormatterBase`4.Serialize(JsonWriter& writer, TCollection value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , TypeInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Utf8Json.Formatters.CollectionFormatterBase`4.Serialize(JsonWriter& writer, TCollection value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , Assembly , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , Module , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , MemberInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , ParameterInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , MethodInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , PropertyInfo , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , FieldDefinition , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , ModelDefinition , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , JoinObject , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Utf8Json.Formatters.ListFormatter`1.Serialize(JsonWriter& writer, List`1 value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , WebSqlExpression , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
  at Serialize(Byte[][] , Object[] , JsonWriter& , WebLoadingListCriteria , IJsonFormatterResolver )
  at Utf8Json.Resolvers.Internal.DynamicMethodAnonymousFormatter`1.Serialize(JsonWriter& writer, T value, IJsonFormatterResolver formatterResolver)
jensbrak commented 4 years ago

Yup. Got that one too. A generic class with a dictionary based on enums in my case.