AqlaSolutions / AqlaSerializer

Binary serializer with full .NET support!
http://www.aqla.net
Other
17 stars 3 forks source link

Is Aqla's metadata inspection thread-safe? #55

Closed inethui closed 1 year ago

inethui commented 1 year ago

We have a very large amount of classes (more than 10000), and they are configured through RuntimeTypeModel APIs. As compile such a big model takes a very long time, we are leveraging the on-demand compilation mechanism which happens when the type is entered during serialization/deserialization. However, out application runs in a multi-thread context, and we do see strange behaviors, for example, serialization is fine and deserialization failed with error "Wrong format version". Could this be caused by multi-thread issues?

AqlaSolutions commented 1 year ago

Compilation and registering types to the model are different things. Both are thread safe but registering same types in a different order may break compatibility with previously written data. Therefore it's recommended to register everything at the start but it's not necessary to compile it. If AutoCompile is true, the compilation only happens on demand.

inethui commented 1 year ago

Thanks, this really helps!