是否有可能从 protobuf-net 获得更详细的错误
Is it possible to get a more detailed error from protobuf-net
是否可以从 protobuf-net
得到更详细的错误信息?
我发现 Channelizer
有问题,但它很大 class,我已经检查了好几次了。
是否可以打开调试日志或任何有助于发现问题的东西?
ProtoBuf.ProtoException: Unable to resolve sub-type of: AE.DataModel.IssueStore (Intelsat.AE.OperationalDataModel.Channelizer) ---> System.InvalidOperationException: Unable to resolve sub-type of: AE.DataModel.IssueStore
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
--- End of inner exception stack trace ---
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
at ProtoBuf.Meta.ValueMember.TryGetCoreSerializer(RuntimeTypeModel model, DataFormat dataFormat, Type type, WireType& defaultWireType, Boolean asReference, Boolean dynamicType, Boolean overwriteList, Boolean allowComplexTypes)
at ProtoBuf.Meta.ValueMember.BuildSerializer()
at ProtoBuf.Meta.MetaType.BuildSerializer()
at ProtoBuf.Meta.MetaType.get_Serializer()
at ProtoBuf.Meta.RuntimeTypeModel.Serialize(Int32 key, Object value, ProtoWriter dest)
at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context)
at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance)
enter code here
更新
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
public class Channelizer : UniqueDataAccessBase, IChannelizer
{
public Channelizer()
{
this.ReceivePorts = new Dictionary<string, ChannelizerReceivePort>();
this.TransmitPorts = new Dictionary<string, ChannelizerTransmitPort>();
this.LimiterPowerMargins = new List<LimiterPowerMargin>();
}
public Dictionary<string, ChannelizerReceivePort> ReceivePorts { get; set; }
public Dictionary<string, ChannelizerTransmitPort> TransmitPorts { get; set; }
public double InputPortPowerMaxWarning { get; set; }
public double InputPortPowerMaxError { get; set; }
public double OutputPortPowerMaxWarning { get; set; }
public double OutputPortPowerMaxError { get; set; }
public double MaxGain { get; set; }
public double SalcDeltaMarg { get; set; }
public double SalcRange { get; set; }
public double RefFrontEndlossAvg { get; set; }
public double RefBackEndlossAvg { get; set; }
public List<LimiterPowerMargin> LimiterPowerMargins { get; set; }
}
UniqueDataAccessBase
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10000, "AE.OperationalDataModel.AdjacentCarrierCommon")]
[ProtoInclude(10200, "AE.OperationalDataModel.AdjacentTransmitEarthStationAntenna")]
[ProtoInclude(10300, "AE.OperationalDataModel.AdjacentConnectivityLink")]
[ProtoInclude(10400, "AE.OperationalDataModel.Amplifier")]
[ProtoInclude(10500, "AE.OperationalDataModel.AmplifierModel")]
[ProtoInclude(10600, "AE.OperationalDataModel.Beam")]
[ProtoInclude(10700, "AE.OperationalDataModel.Block")]
[ProtoInclude(10800, "AE.OperationalDataModel.BlockLeg")]
[ProtoInclude(10900, "AE.OperationalDataModel.Device")]
[ProtoInclude(11000, "AE.OperationalDataModel.Carrier")]
[ProtoInclude(11100, "AE.OperationalDataModel.CarrierDestination")]
[ProtoInclude(11200, "AE.OperationalDataModel.CarrierDownlink")]
[ProtoInclude(11300, "AE.OperationalDataModel.Network")]
[ProtoInclude(11400, "AE.OperationalDataModel.Channelizer")]
[ProtoInclude(11500, "AE.OperationalDataModel.Connection")]
[ProtoInclude(11600, "AE.OperationalDataModel.ConnectivityLink")]
[ProtoInclude(11700, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11800, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11900, "AE.OperationalDataModel.PayloadChain")]
[ProtoInclude(12000, "AE.OperationalDataModel.Satellite")]
[ProtoInclude(12200, "AE.OperationalDataModel.SubChannel")]
[ProtoInclude(12300, "AE.OperationalDataModel.Switch")]
[ProtoInclude(12400, "AE.OperationalDataModel.TransmissionParameter")]
[ProtoInclude(12500, "AE.OperationalDataModel.Channel")]
[ProtoInclude(12600, "AE.OperationalDataModel.ChannelizerPort")]
public class UniqueDataAccessBase : IssueStore, IUniqueDataAccessBase
{
public UniqueDataAccessBase()
: this("Id")
{
}
public UniqueDataAccessBase(string idPropName)
{
this.Id = Constants.NullString;
this.IdPropertyName = idPropName;
}
public DatabaseCompletion DatabaseCompletionMethod { get; set; }
public string Id { get; set; } // tdb_amp_id
public string IdPropertyName { get; set; }
}
ChannelizerReceivePort
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
public class ChannelizerReceivePort : ChannelizerPort
{
public ChannelizerReceivePort()
{
this.Channels = new List<ReceiveChannel>();
this.Measurements = new List<ChannelizerReceivePortMeasurement>();
}
public List<ReceiveChannel> Channels { get; set; }
public List<ChannelizerReceivePortMeasurement> Measurements { get; set; }
}
ChannelizerPort
[ProtoContract]
[ProtoInclude(100, typeof(ChannelizerReceivePort))]
[ProtoInclude(200, typeof(ChannelizerTransmitPort))]
public abstract class ChannelizerPort : UniqueDataAccessBase, IChannelizerPort
{
}
UniqueDataAccessBase
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10000, "AE.OperationalDataModel.AdjacentCarrierCommon")]
[ProtoInclude(10200, "AE.OperationalDataModel.AdjacentTransmitEarthStationAntenna")]
[ProtoInclude(10300, "AE.OperationalDataModel.AdjacentConnectivityLink")]
[ProtoInclude(10400, "AE.OperationalDataModel.Amplifier")]
[ProtoInclude(10500, "AE.OperationalDataModel.AmplifierModel")]
[ProtoInclude(10600, "AE.OperationalDataModel.Beam")]
[ProtoInclude(10700, "AE.OperationalDataModel.Block")]
[ProtoInclude(10800, "AE.OperationalDataModel.BlockLeg")]
[ProtoInclude(10900, "AE.OperationalDataModel.Device")]
[ProtoInclude(11000, "AE.OperationalDataModel.Carrier")]
[ProtoInclude(11100, "AE.OperationalDataModel.CarrierDestination")]
[ProtoInclude(11200, "AE.OperationalDataModel.CarrierDownlink")]
[ProtoInclude(11300, "AE.OperationalDataModel.Network")]
[ProtoInclude(11400, "AE.OperationalDataModel.Channelizer")]
[ProtoInclude(11500, "AE.OperationalDataModel.Connection")]
[ProtoInclude(11600, "AE.OperationalDataModel.ConnectivityLink")]
[ProtoInclude(11700, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11800, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11900, "AE.OperationalDataModel.PayloadChain")]
[ProtoInclude(12000, "AE.OperationalDataModel.Satellite")]
[ProtoInclude(12200, "AE.OperationalDataModel.SubChannel")]
[ProtoInclude(12300, "AE.OperationalDataModel.Switch")]
[ProtoInclude(12400, "AE.OperationalDataModel.TransmissionParameter")]
[ProtoInclude(12500, "AE.OperationalDataModel.Channel")]
[ProtoInclude(12600, "AE.OperationalDataModel.ChannelizerPort")]
public class UniqueDataAccessBase : IssueStore, IUniqueDataAccessBase
{
public UniqueDataAccessBase()
: this("Id")
{
}
public UniqueDataAccessBase(string idPropName)
{
this.Id = Constants.NullString;
this.IdPropertyName = idPropName;
}
public DatabaseCompletion DatabaseCompletionMethod { get; set; }
public string Id { get; set; }
public string IdPropertyName { get; set; }
}
IssueStore
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10100, "AE.DataModel.DataAccessBase")]
[ProtoInclude(10200, "AE.Common.Model.UniqueDataAccessBase")]
[ProtoInclude(10400, "AE.Common.Model.UniqueDataAccessBase")]
[ProtoInclude(10500, "AE.OperationalDataModel.BeamBwSegment")]
[ProtoInclude(10600, "AE.OperationalDataModel.FrequencyRange")]
public class IssueStore : IIssueStore, IStateChecker
{
public IssueStore()
{
this.Issues = new List<Error>();
}
public List<Error> Issues { get; set; }
}
这是完整图片
正如@MarcGravell 在评论中所说 "if you aren't using typeof, then you need to use the assembly qualified name (AQN, which is available on Type)."
所以,尝试使用
typeof
,如果不可能的话goto 2
使用程序集限定名,可以从typeof(int).Type
获取
顺便说一句:请确定,您使用的是最新版本。 protobuf-net 2.3.0 是调试友好的版本
是否可以从 protobuf-net
得到更详细的错误信息?
我发现 Channelizer
有问题,但它很大 class,我已经检查了好几次了。
是否可以打开调试日志或任何有助于发现问题的东西?
ProtoBuf.ProtoException: Unable to resolve sub-type of: AE.DataModel.IssueStore (Intelsat.AE.OperationalDataModel.Channelizer) ---> System.InvalidOperationException: Unable to resolve sub-type of: AE.DataModel.IssueStore
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour()
at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled)
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
--- End of inner exception stack trace ---
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
at ProtoBuf.Meta.ValueMember.TryGetCoreSerializer(RuntimeTypeModel model, DataFormat dataFormat, Type type, WireType& defaultWireType, Boolean asReference, Boolean dynamicType, Boolean overwriteList, Boolean allowComplexTypes)
at ProtoBuf.Meta.ValueMember.BuildSerializer()
at ProtoBuf.Meta.MetaType.BuildSerializer()
at ProtoBuf.Meta.MetaType.get_Serializer()
at ProtoBuf.Meta.RuntimeTypeModel.Serialize(Int32 key, Object value, ProtoWriter dest)
at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context)
at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance)
enter code here
更新
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
public class Channelizer : UniqueDataAccessBase, IChannelizer
{
public Channelizer()
{
this.ReceivePorts = new Dictionary<string, ChannelizerReceivePort>();
this.TransmitPorts = new Dictionary<string, ChannelizerTransmitPort>();
this.LimiterPowerMargins = new List<LimiterPowerMargin>();
}
public Dictionary<string, ChannelizerReceivePort> ReceivePorts { get; set; }
public Dictionary<string, ChannelizerTransmitPort> TransmitPorts { get; set; }
public double InputPortPowerMaxWarning { get; set; }
public double InputPortPowerMaxError { get; set; }
public double OutputPortPowerMaxWarning { get; set; }
public double OutputPortPowerMaxError { get; set; }
public double MaxGain { get; set; }
public double SalcDeltaMarg { get; set; }
public double SalcRange { get; set; }
public double RefFrontEndlossAvg { get; set; }
public double RefBackEndlossAvg { get; set; }
public List<LimiterPowerMargin> LimiterPowerMargins { get; set; }
}
UniqueDataAccessBase
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10000, "AE.OperationalDataModel.AdjacentCarrierCommon")]
[ProtoInclude(10200, "AE.OperationalDataModel.AdjacentTransmitEarthStationAntenna")]
[ProtoInclude(10300, "AE.OperationalDataModel.AdjacentConnectivityLink")]
[ProtoInclude(10400, "AE.OperationalDataModel.Amplifier")]
[ProtoInclude(10500, "AE.OperationalDataModel.AmplifierModel")]
[ProtoInclude(10600, "AE.OperationalDataModel.Beam")]
[ProtoInclude(10700, "AE.OperationalDataModel.Block")]
[ProtoInclude(10800, "AE.OperationalDataModel.BlockLeg")]
[ProtoInclude(10900, "AE.OperationalDataModel.Device")]
[ProtoInclude(11000, "AE.OperationalDataModel.Carrier")]
[ProtoInclude(11100, "AE.OperationalDataModel.CarrierDestination")]
[ProtoInclude(11200, "AE.OperationalDataModel.CarrierDownlink")]
[ProtoInclude(11300, "AE.OperationalDataModel.Network")]
[ProtoInclude(11400, "AE.OperationalDataModel.Channelizer")]
[ProtoInclude(11500, "AE.OperationalDataModel.Connection")]
[ProtoInclude(11600, "AE.OperationalDataModel.ConnectivityLink")]
[ProtoInclude(11700, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11800, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11900, "AE.OperationalDataModel.PayloadChain")]
[ProtoInclude(12000, "AE.OperationalDataModel.Satellite")]
[ProtoInclude(12200, "AE.OperationalDataModel.SubChannel")]
[ProtoInclude(12300, "AE.OperationalDataModel.Switch")]
[ProtoInclude(12400, "AE.OperationalDataModel.TransmissionParameter")]
[ProtoInclude(12500, "AE.OperationalDataModel.Channel")]
[ProtoInclude(12600, "AE.OperationalDataModel.ChannelizerPort")]
public class UniqueDataAccessBase : IssueStore, IUniqueDataAccessBase
{
public UniqueDataAccessBase()
: this("Id")
{
}
public UniqueDataAccessBase(string idPropName)
{
this.Id = Constants.NullString;
this.IdPropertyName = idPropName;
}
public DatabaseCompletion DatabaseCompletionMethod { get; set; }
public string Id { get; set; } // tdb_amp_id
public string IdPropertyName { get; set; }
}
ChannelizerReceivePort
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
public class ChannelizerReceivePort : ChannelizerPort
{
public ChannelizerReceivePort()
{
this.Channels = new List<ReceiveChannel>();
this.Measurements = new List<ChannelizerReceivePortMeasurement>();
}
public List<ReceiveChannel> Channels { get; set; }
public List<ChannelizerReceivePortMeasurement> Measurements { get; set; }
}
ChannelizerPort
[ProtoContract]
[ProtoInclude(100, typeof(ChannelizerReceivePort))]
[ProtoInclude(200, typeof(ChannelizerTransmitPort))]
public abstract class ChannelizerPort : UniqueDataAccessBase, IChannelizerPort
{
}
UniqueDataAccessBase
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10000, "AE.OperationalDataModel.AdjacentCarrierCommon")]
[ProtoInclude(10200, "AE.OperationalDataModel.AdjacentTransmitEarthStationAntenna")]
[ProtoInclude(10300, "AE.OperationalDataModel.AdjacentConnectivityLink")]
[ProtoInclude(10400, "AE.OperationalDataModel.Amplifier")]
[ProtoInclude(10500, "AE.OperationalDataModel.AmplifierModel")]
[ProtoInclude(10600, "AE.OperationalDataModel.Beam")]
[ProtoInclude(10700, "AE.OperationalDataModel.Block")]
[ProtoInclude(10800, "AE.OperationalDataModel.BlockLeg")]
[ProtoInclude(10900, "AE.OperationalDataModel.Device")]
[ProtoInclude(11000, "AE.OperationalDataModel.Carrier")]
[ProtoInclude(11100, "AE.OperationalDataModel.CarrierDestination")]
[ProtoInclude(11200, "AE.OperationalDataModel.CarrierDownlink")]
[ProtoInclude(11300, "AE.OperationalDataModel.Network")]
[ProtoInclude(11400, "AE.OperationalDataModel.Channelizer")]
[ProtoInclude(11500, "AE.OperationalDataModel.Connection")]
[ProtoInclude(11600, "AE.OperationalDataModel.ConnectivityLink")]
[ProtoInclude(11700, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11800, "AE.OperationalDataModel.EarthStationAntenna")]
[ProtoInclude(11900, "AE.OperationalDataModel.PayloadChain")]
[ProtoInclude(12000, "AE.OperationalDataModel.Satellite")]
[ProtoInclude(12200, "AE.OperationalDataModel.SubChannel")]
[ProtoInclude(12300, "AE.OperationalDataModel.Switch")]
[ProtoInclude(12400, "AE.OperationalDataModel.TransmissionParameter")]
[ProtoInclude(12500, "AE.OperationalDataModel.Channel")]
[ProtoInclude(12600, "AE.OperationalDataModel.ChannelizerPort")]
public class UniqueDataAccessBase : IssueStore, IUniqueDataAccessBase
{
public UniqueDataAccessBase()
: this("Id")
{
}
public UniqueDataAccessBase(string idPropName)
{
this.Id = Constants.NullString;
this.IdPropertyName = idPropName;
}
public DatabaseCompletion DatabaseCompletionMethod { get; set; }
public string Id { get; set; }
public string IdPropertyName { get; set; }
}
IssueStore
[ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
[ProtoInclude(10100, "AE.DataModel.DataAccessBase")]
[ProtoInclude(10200, "AE.Common.Model.UniqueDataAccessBase")]
[ProtoInclude(10400, "AE.Common.Model.UniqueDataAccessBase")]
[ProtoInclude(10500, "AE.OperationalDataModel.BeamBwSegment")]
[ProtoInclude(10600, "AE.OperationalDataModel.FrequencyRange")]
public class IssueStore : IIssueStore, IStateChecker
{
public IssueStore()
{
this.Issues = new List<Error>();
}
public List<Error> Issues { get; set; }
}
这是完整图片
正如@MarcGravell 在评论中所说 "if you aren't using typeof, then you need to use the assembly qualified name (AQN, which is available on Type)."
所以,尝试使用
typeof
,如果不可能的话goto 2
使用程序集限定名,可以从
typeof(int).Type
获取
顺便说一句:请确定,您使用的是最新版本。 protobuf-net 2.3.0 是调试友好的版本