Open GoogleCodeExporter opened 8 years ago
Recursion doesn't relate to tag numbers; do you have any kind of example?
usually this relates to something like a .Parent property.
Original comment by marc.gravell
on 4 Jun 2012 at 12:19
I have two classes, 1- Asset and 2- Plant. Asset is the parent class of Plant,
I have used ProtoInclude in Asset class typeof Plant.
Following is the sample code of Asset and Plant:
//Asset Class
[ProtoContract(SkipConstructor = true)]
[ProtoInclude(500, typeof(Plant))]
public class Asset : ISerializable, TreeList.IVirtualTreeListData, IDisposable,
ICloneable
{
//Constructor
[ProtoMember(1, DynamicType = true)]
public List<Asset> AllAssets
{
get
{
//Code
}
}
[ProtoMember(2, DynamicType = true)]
public List<Asset> AssetHierarcy
{
get
{
//Code
}
}
[ProtoMember(3, DynamicType = true)]
public List<Asset> ChildAssets { get; private set; }
}
//Plant Class
[ProtoContract(SkipConstructor = true)]
public class Plant : Asset
{
//Costructor
[ProtoMember (101, DynamicType = true)]
public Parameter Altitude { get; set; }
[ProtoMember(105, DynamicType = true)]
public Asset Blowers
{
get
{
//Code
return null;
}
}
}
While serializing I am getting error "Possible recursion detected
(offset: 2 level(s))".
Original comment by farooqmu...@gmail.com
on 5 Jun 2012 at 4:58
Is there any minimum example of some fake data that actually shows the problem,
that I can use to repro? Also, all those DynamicType are unnecessary (and
should probably be removed).
Original comment by marc.gravell
on 5 Jun 2012 at 6:22
Original issue reported on code.google.com by
farooqmu...@gmail.com
on 4 Jun 2012 at 11:30