Repository navigation
Description
When calling MessagePackSerializer.Get in SL5 (where T is some complex object) I get the following exception
Attempt by method 'MsgPack.Serialization.ReflectionExtensions.CreateInstancePreservingExceptionType(System.Type, System.Object[])' to access method 'MsgPack.Serialization.DefaultSerializers.GenericSerializer+ListInstanceFactory`1<System.__Canon>..ctor()' failed.
I'm using version 0.8.0. Any pointer as to what this means?
My stack trace is:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at MsgPack.Serialization.ReflectionExtensions.CreateInstancePreservingExceptionType(Type type, Object[] constructorParameters)
at MsgPack.Serialization.DefaultSerializers.GenericSerializer.CreateListSerializer(SerializationContext context, Type itemType, PolymorphismSchema schema)
at MsgPack.Serialization.DefaultSerializers.GenericSerializer.Create(SerializationContext context, Type targetType, PolymorphismSchema schema)
at MsgPack.Serialization.DefaultSerializers.GenericSerializer.Create[T](SerializationContext context, PolymorphismSchema schema)
at MsgPack.Serialization.SerializationContext.GetSerializer[T](Object providerParameter)
at MsgPack.Serialization.SerializationContext.SerializerGetter1.Get(SerializationContext context, Object providerParameter) at MsgPack.Serialization.SerializationContext.SerializerGetter.Get(SerializationContext context, Type targetType, Object providerParameter) at MsgPack.Serialization.SerializationContext.GetSerializer(Type targetType, Object providerParameter) at MsgPack.Serialization.ReflectionSerializers.ReflectionSerializerHelper.GetMetadata(Type targetType, IList1 members, SerializationContext context, Func2[]& getters, Action2[]& setters, MemberInfo[]& memberInfos, DataMemberContract[]& contracts, MessagePackSerializer[]& serializers)
at MsgPack.Serialization.ReflectionSerializers.ReflectionObjectMessagePackSerializer1..ctor(SerializationContext context) at MsgPack.Serialization.MessagePackSerializer.CreateReflectionInternal[T](SerializationContext context, Type concreteType, PolymorphismSchema schema) at MsgPack.Serialization.MessagePackSerializer.CreateInternal[T](SerializationContext context, PolymorphismSchema schema) at MsgPack.Serialization.SerializationContext.GetSerializer[T](Object providerParameter) at MsgPack.Serialization.SerializationContext.SerializerGetter1.Get(SerializationContext context, Object providerParameter)
at MsgPack.Serialization.SerializationContext.SerializerGetter.Get(SerializationContext context, Type targetType, Object providerParameter)
at MsgPack.Serialization.SerializationContext.GetSerializer(Type targetType, Object providerParameter)
at MsgPack.Serialization.ReflectionSerializers.ReflectionSerializerHelper.GetMetadata(Type targetType, IList1 members, SerializationContext context, Func2[]& getters, Action2[]& setters, MemberInfo[]& memberInfos, DataMemberContract[]& contracts, MessagePackSerializer[]& serializers) at MsgPack.Serialization.ReflectionSerializers.ReflectionObjectMessagePackSerializer1..ctor(SerializationContext context)
at MsgPack.Serialization.MessagePackSerializer.CreateReflectionInternal[T](SerializationContext context, Type concreteType, PolymorphismSchema schema)
at MsgPack.Serialization.MessagePackSerializer.CreateInternal[T](SerializationContext context, PolymorphismSchema schema)
at MsgPack.Serialization.SerializationContext.GetSerializer[T](Object providerParameter)
at MsgPack.Serialization.MessagePackSerializer.Get[T](SerializationContext context, Object providerParameter)
at MsgPack.Serialization.MessagePackSerializer.Get[T](SerializationContext context)
at MsgPack.Serialization.MessagePackSerializer.GetT
Activity
yfakariya commentedon Dec 9, 2016
Thank you for reporting!
Would you tell me about where did you run the problem? It might be related to code access security.
ericontilt commentedon Dec 10, 2016
Sure. It's in the callback handler of a web request. What's interesting though, is that we have version 0.4 in production code and it works fine. I literally updated the package version and changed the line of invocation from .Create to .Get. That's it.
By the way, I also tried with version 0.6, and I get a bit more detail with my exceptions. It first throws on one of my custom types (a custom Date class), but it will also throw on something like TimeSpan. Again, with no changes on the backend in the data class which worked fine with the older version.
yfakariya commentedon Dec 24, 2016
Thank you for interesting information. I fixed a lot for Xamarin and Unity support in 0.5, it may affect something. I will investigate it.
Remove memcmp from MessagePackString. Fix #205.
yfakariya commentedon Jan 9, 2017
I confirmed that this issue is caused by code access security. I'm fixing this issue.
ericontilt commentedon Jan 9, 2017
Ok, cool. Please let me know if there's anything I can do to help test it.
Fix built-in serializer helpers failed in non-privileged Silverlight …
carldiegelmann commentedon Feb 6, 2017
When will this fix be available in any version? Also in 0.8.2? Thanks!
yfakariya commentedon Feb 6, 2017
0.9.0. I'm fixing #202 now, and then I will release rc.
Fix build error.
Fix build error.