skbkontur / GroBuf

Fast binary serializer
MIT License
64 stars 10 forks source link

Hash Collision Issue When Serializing a DataSet #15

Open agatlin opened 5 years ago

agatlin commented 5 years ago

I am receiving the following error when I either try to directory serialize a DataSet or attempt to serialize an object which contains a DataSet.

Hash code collision: members 'MarshalByValueComponent.Site' and 'DataSet.Site' have the same hash code = 11520371743981427527

Here are relevant portions of the StackTrace.

   at GroBuf.GroBufHelpers.CalcHashesAndCheck(IEnumerable`1 dataMembers)
   at GroBuf.Writers.ClassWriterBuilder.WriteNotEmpty(WriterMethodBuilderContext context)
   at GroBuf.Writers.WriterBuilderBase.BuildWriter(WriterTypeBuilderContext writerTypeBuilderContext)
   at GroBuf.Writers.WriterTypeBuilderContext.GetWriter(Type type, Boolean isRoot, Boolean ignoreCustomSerialization)
   at GroBuf.Writers.WriterMethodBuilderContext.CallWriter(GroboIL il, Type type)
   at GroBuf.Writers.WriterMethodBuilderContext.CallWriter(Type type)
   at GroBuf.Writers.ClassWriterBuilder.WriteNotEmpty(WriterMethodBuilderContext context)
   at GroBuf.Writers.WriterBuilderBase.BuildWriter(WriterTypeBuilderContext writerTypeBuilderContext)
   at GroBuf.Writers.WriterTypeBuilderContext.GetWriter(Type type, Boolean isRoot, Boolean ignoreCustomSerialization)
   at GroBuf.Writers.WriterTypeBuilder.BuildWriter(Type type, Boolean ignoreCustomSerialization)
   at GroBuf.GroBufWriter.GetWriter(Type type, Boolean ignoreCustomSerialization)
   at GroBuf.GroBufWriter.BuildWriter[T](Boolean ignoreCustomSerialization)
   at GroBuf.GroBufWriter.GetWriterAndSizeCounter[T](Boolean ignoreCustomSerialization)
   at GroBuf.GroBufWriter.Write[T](Boolean ignoreCustomSerialization, T obj)
   at GroBuf.GroBufWriter.Write[T](T obj)
   at GroBuf.Serializer.Serialize[T](T obj)
   at xxxx.yyyy.zzz(List`1 aaaa) in <<some file>>.cs:line 74

_exceptionMethod = {UInt64[] CalcHashesAndCheck(System.Collections.Generic.IEnumerable1[GroBuf.DataMembersExtracters.IDataMember])} ` I am not sure why a dataset would be causing problems. It probably makes no difference but these datasets were populated from .csv, .xls and .xlsx files. All of them are failing. The hash collision occurs on every attempt to serialize a DataSet.

agatlin commented 5 years ago

When I loaded the source locally and ran the unit tests, I got a similar error on the "TestReproForIssue5 / Virtual Property".

I did not have the NET SDK version 2.2.100 installed which was referenced in the global.json so I tried 2.2.200 and 2.1.400 just to see if perhaps a bug had been introduced in .NET. I still got the same error.

image