Protobuf.net 可移植异常 - 检查元数据时超时
Protobuf.net Portable Exception - Timeout while inspecting metadata
我正在使用便携式 protobuf-net.dll 版本 2.0.0.668
我的单元测试一直抛出这个错误:
ProtoBuf.ProtoException : Timeout while inspecting metadata; this may indicate a deadlock. This can often be avoided by preparing necessary serializers during application initialization, rather than allowing multiple threads to perform the initial metadata inspection; please also see the LockContended event
我尝试了以下但没有成功:
Serializer.PrepareSerializer<ParametersSetRequestMessage>();
测试中没有线程。而且被序列化的类型并不复杂
[ProtoContract]
public class ParametersSetRequestMessage: Message, IParameterMessage
{
public ParametersSetRequestMessage()
{
Type = MessageType.ParametersSetRequest;
BaseType = BaseMessageType.Command;
}
public MessageType Type { get; protected set; }
[ProtoMember(1)]
public List<ParameterSlim> SetParameters { get; set; }
}
[ProtoContract]
public class ParameterSlim
{
[ProtoMember(1)]
public ParameterId ParameterId { get; set; }
[ProtoMember(2)]
public byte[] RawBytes { get; set; }
}
[ProtoContract]
public class Message : IMessage
{
public BaseMessageType BaseType { get; protected set; }
[ProtoMember(1)]
public DateTime ReceivedTime { get; set; }
}
有什么想法吗?
好的 - 对于我的单元测试项目,我添加了不可移植的 nuget 包,现在一切正常。
便携式 dll 似乎有问题。虽然我一直在 ios、Android 和单声道上使用它,但没有任何问题。我的单元测试是 运行 在 windows 机器上进行的。
我正在使用便携式 protobuf-net.dll 版本 2.0.0.668
我的单元测试一直抛出这个错误:
ProtoBuf.ProtoException : Timeout while inspecting metadata; this may indicate a deadlock. This can often be avoided by preparing necessary serializers during application initialization, rather than allowing multiple threads to perform the initial metadata inspection; please also see the LockContended event
我尝试了以下但没有成功:
Serializer.PrepareSerializer<ParametersSetRequestMessage>();
测试中没有线程。而且被序列化的类型并不复杂
[ProtoContract]
public class ParametersSetRequestMessage: Message, IParameterMessage
{
public ParametersSetRequestMessage()
{
Type = MessageType.ParametersSetRequest;
BaseType = BaseMessageType.Command;
}
public MessageType Type { get; protected set; }
[ProtoMember(1)]
public List<ParameterSlim> SetParameters { get; set; }
}
[ProtoContract]
public class ParameterSlim
{
[ProtoMember(1)]
public ParameterId ParameterId { get; set; }
[ProtoMember(2)]
public byte[] RawBytes { get; set; }
}
[ProtoContract]
public class Message : IMessage
{
public BaseMessageType BaseType { get; protected set; }
[ProtoMember(1)]
public DateTime ReceivedTime { get; set; }
}
有什么想法吗?
好的 - 对于我的单元测试项目,我添加了不可移植的 nuget 包,现在一切正常。 便携式 dll 似乎有问题。虽然我一直在 ios、Android 和单声道上使用它,但没有任何问题。我的单元测试是 运行 在 windows 机器上进行的。