Click or drag to resize
SerializationContextResolveSerializer Event
Occurs when the context have not find appropriate registered nor built-in serializer for specified type.

Namespace: MsgPack.Serialization
Assembly: MsgPack (in MsgPack.dll) Version: 0.6.0
Syntax
public event EventHandler<ResolveSerializerEventArgs> ResolveSerializer

Value

Type: SystemEventHandlerResolveSerializerEventArgs
Remarks
This event will be occured when the context could not found known serializer from:
  • Known built-in serializers for arrays, nullables, and collections, etc.
  • Known default serializers for some known various FCL value types and some reference types.
  • Previously registered or generated serializer.
You can instantiate your custom serializer using various ResolveSerializerEventArgs properties, and then call SetSerializerT(MessagePackSerializerT) to provide toward the context.
Note Note
You can use SerializationContext to get dependent serializers as you like, but you should never explicitly register new serializer(s) explicitly via the context from the event handler and its dependents. Instead, you specify the instanciated serializer with SetSerializerT(MessagePackSerializerT) once at a time. Dependent serializer(s) should be registered via next (nested) raise of this event.
Note Note
The context implicitly holds 'lock' for the target type for the requested serializer in the current thread. So you should not use any synchronization primitives in the event handler and its dependents, or you may face complex dead lock. That is, the event handler should be as simple as possible like just instanciate the serializer and set it to the event argument.
See Also