【发布时间】:2017-01-19 16:54:42
【问题描述】:
我正在使用可移植的 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; }
}
有什么想法吗?
【问题讨论】:
标签: c# protobuf-net portable-class-library