是否可以从protobuf-net
获得更详细的错误?
我发现Channelizer
出了问题,但它是一个庞大的课程,我已经多次检查过了。
是否可以打开调试日志或任何有助于查找问题的内容?
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; }
}
这里是全貌
答案 0 :(得分:0)
正如@MarcGravell在评论中所说“如果你没有使用typeof,那么你需要使用汇编限定名称(AQN,可在Type上使用)。”
所以,尝试使用
typeof
,如果不可能goto 2
使用程序集限定名称,您可以从typeof(int).Type
BTW:请确保您使用的是最新版本。 protobuf-net 2.3.0是一个适合调试的版本