So I seem to have hit this roadblock in building my app where an attempt to serialize these two objects of called “Dictionary stat” and “Dictionary properties” just seem impossible. my code is sequential of course and an exception is returned at the point of serializing “stat” which comes before the serialization of"properties", meaning the code never even reaches the point of serializing properties dictionary, thus my first challenge is getting past serializing the stat dictionary. I’m asking both questions so I won’t have to come back to type another question.
Error Message: (UnityFramework)[8340] : FormatterNotRegisteredException: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] is not registered in resolver: MessagePack.Resolvers.StaticCompositeResolver
Things I’ve tried:
Initialized messagePack composite resolvers before attempting to serialize or deserialize anything.:
//initialize messagepack
StaticCompositeResolver.Instance.Register(
MessagePack.Resolvers.GeneratedResolver.Instance,
MessagePack.Resolvers.StandardResolver.Instance,
MessagePack.Resolvers.BuiltinResolver.Instance
);
var option = MessagePackSerializerOptions.Standard.WithResolver(StaticCompositeResolver.Instance);
MessagePackSerializer.DefaultOptions = option;
The generated resolver does seem to cover the Property class, however, the code never reaches there and it throws an error when serializing the “stat” dictionary which comes before the “properties” dictionary. Neither the standard resolver nor the built-in resolver solves the challenge of serializing the “stat” dictionary.
static GeneratedResolverGetFormatterHelper()
{
lookup = new global::System.Collections.Generic.Dictionary<Type, int>(3)
{
{ typeof(global::AchievementManager.Property_ActivationRules), 0 },
{ typeof(global::AchievementManager.Property_UpdateRules), 1 },
{ typeof(global::AchievementManager.Property), 2 },
};
}
What in the world am I supposed to do to get message pack to serialize the two dictionaries. Any help in the right direction would be much appreciated.
Unity Version:2019.4.17f1
ScriptingBackend: IL2CPP
Api Compatibility Level: .Net 4.x
Strip Engine Code: False
Build Platform: IOS and Android