In my application that I'm migrating to v3, I have a bunch of data types that must be serialized:
- Many are in the assembly with the messagepack reference
- A few use
[MessagePackObject]
- Most use hand-authored formatters
- Some are in an assembly w/o a messagepack reference. These have custom formatters declared in the above mentioned assembly.
I mix in the StandardResolver with my own resolver.
Ultimately, the resolver I use must be able to find the formatters that are declared in the same assembly as the data types as well as the formatters I define for data types outside my assembly. The former is easy and well automated. But I have to write my own resolver to find the formatters I define locally for data types found elsewhere because by default, StandardResolver only consults the automatically generated resolver for data types declared in the same assembly.
So I thought I'd create my own top-level resolver that forces the source generated resolver to always be asked, alongside the StandardResolver.
[CompositeResolver(typeof(GeneratedMessagePackResolver), typeof(StandardResolver))]
partial class CombinedResolver { }
The problem here is that CombinedResolver gets generated with this error:
#error No accessible default constructor or static Instance member on GeneratedMessagePackResolver.,
This is almost certainly because source generators (of which MessagePack v3 has two) cannot see each other's output, so it doesn't know that in fact GeneratedMessagePackResolver does in fact have an accessible instance:
public static readonly MsgPack::IFormatterResolver Instance = new GeneratedMessagePackResolver();
In my application that I'm migrating to v3, I have a bunch of data types that must be serialized:
[MessagePackObject]I mix in the
StandardResolverwith my own resolver.Ultimately, the resolver I use must be able to find the formatters that are declared in the same assembly as the data types as well as the formatters I define for data types outside my assembly. The former is easy and well automated. But I have to write my own resolver to find the formatters I define locally for data types found elsewhere because by default, StandardResolver only consults the automatically generated resolver for data types declared in the same assembly.
So I thought I'd create my own top-level resolver that forces the source generated resolver to always be asked, alongside the StandardResolver.
The problem here is that
CombinedResolvergets generated with this error:This is almost certainly because source generators (of which MessagePack v3 has two) cannot see each other's output, so it doesn't know that in fact
GeneratedMessagePackResolverdoes in fact have an accessible instance: