There are several members in the JsonMapper class that are static IDictionary<T> instances. A few are only ever written to during static initialization (which is fine) and thus do not require synchronization. However, there are a few which are mutable and cause synchronization errors.
Message:
System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Stack Trace:
Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
Dictionary`2.set_Item(TKey key, TValue value)
JsonMapper.RegisterExporter[T](ExporterFunc`1 exporter) line 922
JsonSegmentMarshaller.ctor() line 48
UdpSegmentEmitter.ctor() line 45
AWSXRayRecorder.ctor() line 47
TelemetryRecorderTests.ctor() line 25
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
There are several members in the
JsonMapper
class that are staticIDictionary<T>
instances. A few are only ever written to during static initialization (which is fine) and thus do not require synchronization. However, there are a few which are mutable and cause synchronization errors.I've experienced these synchronization issues thru AWSXRayRecorder's usage of your library (https://github.com/aws/aws-xray-sdk-dotnet/issues/282). I've opened a PR with a fix - #142