WebAPIContrib.Core
WebAPIContrib.Core copied to clipboard
Fixed issue where errorHandler in BsonInputFormatter is invoked multitple times
CreateJsonSerializer() may return a serializer that was previously returned to the pool. This means this serializer's Error event already have a subscriber. If we try to add more subscribers (jsonSerializer.Error += errorHandler;), the errorHandler will be invoked multiple times when the serializer fail to Deserialize. Therefore, we need to remove the subscriber before returning the serializer to the pool.