You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My expected generator's behaviour is that doesn't generate if target type is in builtin serializer.
But several types, for example Nullable can generate by SerializerGenerator.
Resulting in, Packed by genereted serializer data can't unpack builtin serializer.
varcontext=newSerializationContext{EnumSerializationMethod=EnumSerializationMethod.ByUnderlyingValue,GeneratorOption=SerializationMethodGeneratorOption.Fast,SerializationMethod=SerializationMethod.Array};vardynamicNullableSerializer=context.GetSerializer<Nullable<int>>();varpreGeneratedSerializer=newSystem_Nullable_1_System_Int32_Serializer(context);varv=dynamicNullableSerializer.PackSingleObject(newNullable<int>(1000));varresult=preGeneratedSerializer.UnpackSingleObject(v);Console.WriteLine(result.Value);// expected = 1000 but result = 2
…s poor code generation for nullable types. Issue #104.
CodeDomContext and AssemblyBuilderCodeGenerationContext did not handle List<T>, Dictionary<TKey,TValue>, Immutable collections, and other collections in reflection based context correctly. So move determination to GenericSerializer itself with refactoring to avoid duplication for immutable collection determination logic.
This commit also add new API PreferReflectionBasedSerializer, which specifies that we prefer reflection based serializer than code-gen based serializer when we use generated serializer. This option is needed for generated serializers to work well in iOS environments.
My expected generator's behaviour is that doesn't generate if target type is in builtin serializer.
But several types, for example
Nullable
can generate by SerializerGenerator.Resulting in, Packed by genereted serializer data can't unpack builtin serializer.
This come from
Serializer.Get
checksArray
,Nullable
,List
,Dictionary
https://github.com/msgpack/msgpack-cli/blob/master/src/MsgPack/Serialization/DefaultSerializers/GenericSerializer.cs#L54-L92
But CodeComContext.BuildIntSerializerExists only see IsArray.
https://github.com/msgpack/msgpack-cli/blob/master/src/MsgPack/Serialization/CodeDomSerializers/CodeDomContext.cs#L149
The following is unexpected result.
The text was updated successfully, but these errors were encountered: