the whole message:
A first chance exception of type ‘System.MissingMethodException’ occurred in Unknown Module.
An exception of type ‘System.MissingMethodException’ occurred in Unknown Module. but was not handled in user code
Exception: Method not found: ‘System.Reflection.MemberTypes System.Reflection.MemberInfo.get_MemberType()’.
Type: System.MissingMethodException
Module: Assembly-CSharp
InnerException:
AdditionalInfo:
at ProtoBuf.Meta.MetaType.GetMemberValue(Attribute attrib, String memberName)
at ProtoBuf.Meta.MetaType.GetFieldBoolean(Boolean& value, Attribute attrib, String memberName)
at ProtoBuf.Meta.MetaType.GetContractFamily(Type type, Object[ ] attributes)
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
at ProtoBuf.Meta.RuntimeTypeModel.GetKeyImpl(Type type)
at ProtoBuf.Meta.TypeModel.GetKey(Type& type)
at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value)
at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance)
at BuildMessage_bw.PbSerialize[T](T data)
at SocketNetWorkMgr_bw.SendNetMessage[T](Int32 msgId, T data)
at GameSendMsg.C2SDailyMissionRefresh(Int32 optType, Int32 missionType)
at QuestMgr.Update()
at Game.Update()
at Global.Update()
at Global.UnityFastInvoke_Update()
i used proto buffer in my game, and the code in proto buffer :
MemberInfo[ ] members = attrib.GetType().GetMember(memberName, BindingFlags.Public | BindingFlags.Instance);
will wrong, when i run the vs project(unity build) in window phone.
but i run the code in a wp project(not unity build) is right.
if someone know the reason,please tell me, thank you very much!!!
The problem you are facing is the incompatibility between Mono and .NET for Windows Phone. Some reflection APIs were removed from the later, so your code works fine in the Editor and builds fine too, because we use Mono in both cases, however it fails when deployed on phone, because .NET is used there.
Look at documentation for .“NET for Windows Phone”, you’ll see there which APIs are available.