StackOverflowException in ServiceStack.Text

I am using ServiceStack.Redis to store MassTransit saga instances. However, I get stack overflow exception coming from ServiceStack.Text each time I want to read the saga document by id. There are no details given and Visual Studio jsut says that the number of stack frames is exceeded. The document looks like this:

    "CorrelationId": "e42b5beb400be1125658e502ab0675a9",
    "TrackedObjectId": 267258,
    "LastPositionReceivedAtUTC": "/Date(-62135596800000-0000)/",
    "Positions": [],
    "Id": "e42b5beb400be1125658e502ab0675a9"
}```

The JSON isn’t going to identify the issue, I’ll need something I can repro. Please provide the classes that you’re trying to deserialize into. StackOverflow Exceptions is likely due to using Types with cyclical dependencies which aren’t supported, but I’ll need to see the classes you’re trying to deserialize into to confirm.

I found it. I used NHibernate for persistence earlier and Positions has a back reference to Trip, whilst Trip contains the list of positions. This gives circular reference, my fault.

1 Like