Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

System.InvalidOperationException: Type is not supported #131

Open
jsmcneal opened this issue Dec 9, 2021 · 0 comments
Open

System.InvalidOperationException: Type is not supported #131

jsmcneal opened this issue Dec 9, 2021 · 0 comments

Comments

@jsmcneal
Copy link

jsmcneal commented Dec 9, 2021

Simple enough:

MasterMessageModel masterMessage = ZeroFormatter.ZeroFormatterSerializer.Deserialize<MasterMessageModel>(trssFrame.ToByteArray());

My Model
[ZeroFormattable] public class MasterMessageModel : MessageBase { [Index(2)] public virtual Guid PlanKey { get; set; } = Guid.Empty; [Index(3)] public virtual Guid DeviceKey { get; set; } = Guid.Empty; [Index(6)] public virtual int DeviceID {get; set;} [Index(7)] public virtual int ModeOfTransport { get; set; } = 0; [Index(8)] public virtual DateTime MonitorTime { get; set; } [Index(9)] public virtual DateTime SensorTime { get; set; } [Index(10)] public virtual string MessageType { get; set; } = string.Empty; [Index(11)] public virtual int Sequence { get; set; } [Index(12)] public virtual string Details { get; set; } = string.Empty; [Index(13)] public virtual bool Acknowledged { get; set; } = true; [Index(14)] public virtual string Encryption { get; set; } = string.Empty; [Index(15)] public virtual string Authentication { get; set; } = string.Empty; [Index(16)] public virtual string Spoof { get; set; } = string.Empty; [Index(17)] public virtual int ReceiveChannel { get; set; }
}

This is what gets thrown:

Exception thrown: 'System.InvalidOperationException' in Alexinea.ZeroFormatter.dll
MQZFReceiver.HandleSDR2Message() System.InvalidOperationException: Type is not supported, occurs invalid error: MasterMessageModel InnerException:System.IO.FileLoadException: Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
at ZeroFormatter.Formatters.DynamicObjectDescriptor.GetMembers(Type resolverType, Type type, Boolean isClass)
at ZeroFormatter.Formatters.DynamicFormatter.CreateTTypeResolver,T
at ZeroFormatter.Formatters.Formatter.GetBuiltinFormatter[TTypeResolver,T](Type t, TTypeResolver resolver)
at ZeroFormatter.Formatters.Formatter`2..cctor()

Why is the Type not supported on an innocuous model?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant