On my development machine I do not get an error, I deployed to another machine with remote debugged and it throws a StackOverflowException error when Deserializing the xml to a class object. I am pretty sure the xml is incorrect and there is recursion going on. Please can somebody help me identify it as I have tried and failed.
One more question is why does the exception not occur on my development machine, could it be suppressed in the IDE settings? How do I duplicate the exception I am getting on the remote machine to my develpoment machine.
XML Code
[XmlRoot("Symbols")]
public class Symbols
{
[XmlElement("Metals")]
public Metal MetalGroup { get; set; }
[XmlElement("Forex")]
public Forex ForexGroup { get; set; }
[XmlElement("Indices")]
public Indices IndicesGroup { get; set; }
[XmlElement("Other")]
public Other OtherGroup { get; set; }
public class Metal
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlElement("Symbol")]
public List<MetalSymbol> SymbolList { get; set; }
public class MetalSymbol
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
}
}
public class Forex
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlElement("Symbol")]
public List<ForexSymbol> SymbolList { get; set; }
public class ForexSymbol
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
}
}
public class Indices
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlElement("Symbol")]
public List<IndicesSymbol> SymbolList { get; set; }
public class IndicesSymbol
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
}
}
public class Other
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlElement("Symbol")]
public List<OtherSymbol> SymbolList { get; set; }
public class OtherSymbol
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
}
}
}
**Client Code**
XmlSerializer serializer = new XmlSerializer(typeof(Symbols));
Xml File that is created
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Symbols>
<Forex name="Forex">
<Symbol name="EURUSD" />
<Symbol name="GBPUSD" />
<Symbol name="EURJPY" />
<Symbol name="USDJPY" />
<Symbol name="AUDUSD" />
<Symbol name="USDCHF" />
<Symbol name="GBPJPY" />
<Symbol name="USDCAD" />
<Symbol name="EURGBP" />
<Symbol name="- add symbol code -" />
</Forex>
<Metals name="Metals">
<Symbol name="XAUUSD" />
<Symbol name="XAGUSD" />
<Symbol name="XAUEUR" />
<Symbol name="XAGEUR" />
<Symbol name="- add symbol code -" />
</Metals>
<Indices name="Indices">
<Symbol name="#GerTech30" />
<Symbol name="#GerTech30" />
<Symbol name="#Holland25" />
<Symbol name="- add symbol code -" />
</Indices>
<Other name="Other">
<Symbol name="#Easyjet" />
<Symbol name="- add symbol code -" />
</Other>
</Symbols>
many thanks,
Paul.