Thread-safety for _cache dictionary of TypeData
We're are getting strange error (null reference) when using BinaryData concurrently the first time the application start.
Our behavior is that we could have a queue fill of some messages that will use BinaryData to serialize, and when we start the process this messages are managed in parallel so creating concurrency on BinaryData internals, and I think that using
Dictionary instead of
ConcurrentDictionary is creating the issue, even if the error is not clear, but the fact is that if I execute one message at time I found no problem, if I run multiple serialization in parallel when the process is just created, I get errors from BinaryData library.
I will try to investigate further more and post a repro sample.
Here's the repo where I reproduced the error: https://github.com/micdenny/TestingBinaryDataConcurrency