1

I have a simple WCF service:

public Order[] GetOrdersByStatus(int statusid)
{
    OrderService os = new OrderService();
    TList<Order> orders = os.GetByOrderStateID(statusid);

    return orders.ToArray();
}

when this returns it throws a StackOverflowException in mscorlib. Any idea what could be causing this?

The OrderService is a NetTiers generated service and Order is a NetTiers entity object. when I return the data is already pulled from the database and ready to go. What besides a bug in WCF could cause a StackOverflowException after I return from my operation?

joshperry
  • 41,167
  • 16
  • 88
  • 103
  • Yes, this is very true, to be honest I haven't even looked at the implementation of the NetTiers entities. Perhaps the problem lies there, I just assumed that NetTiers entities would have been used in this manner and would generate decent code. – joshperry Dec 12 '08 at 06:47

1 Answers1

3

If the implementation of the serialization of the "Order" type is bad, that could be it.

Brian
  • 117,631
  • 17
  • 236
  • 300
  • .netTiers generated entities have an entity key. That entity key has a property that points back to it's parent, but that property is not marked as [XmlIgnore] or [NonSerialized]. When serializing the entity it created a cycle and the serialization would blow the stack. Thanks for the help. – joshperry Dec 12 '08 at 18:37