ShipEngine / shipengine-dotnet

The official ShipEngine SDK for C# and the .NET Framework
https://www.shipengine.com/docs/
Apache License 2.0
11 stars 11 forks source link

ListCarriers() throws 500 error - System.Text.Json.JsonException: A possible object cycle was detected. #45

Closed Roland-Park closed 2 years ago

Roland-Park commented 2 years ago

Seems like some kind of mapping/serialization issue. I'm using ShipEngine nuget package v 1.0.1.

Here is my code, using .net6/vs2022: var shipEngine = new ShipEngine(shipEngineApiKey); var carriers = await shipEngine.ListCarriers();

"carriers" is returning a JsonException: System.Text.Json.JsonException: A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support cycles. Path: $.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.

Roland-Park commented 2 years ago

So sorry - I was missing the await in the controller using my method.