views:

446

answers:

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?

+1  A: 

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

Brian
.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