MessagePack-CSharp/MessagePack-CSharp

Source generated resolver should support hand-written formatters that use the singleton pattern

AArnott opened this issue · 1 comments

A hand-written formatter with these members should be supported:

internal static readonly IMessagePackFormatter<Encoding?> Instance = new EncodingFormatter();

private EncodingFormatter()
{
}

But the latest beta says the constructor should be made internal at least.

I know our source generated resolvers cache the formatter instance so it doesn't matter too much, but developers may want to enforce the singleton pattern by keeping the constructor private.