Skip to content

LitJson does not properly handle models that contain recursive public properties. Examples: Guid, DateTimeOffset #212

@kdprince

Description

@kdprince
 public class ModelWithSelfReferenceProp
  {
      public ModelWithSelfReferenceProp()
      {
          RightNow = DateTime.Now;
      }
      public DateTimeOffset RightNow { get; }
  }

  [Fact]
  public void TestShouldNotThrowError()
  {
      var model = new ModelWithSelfReferenceProp();
      
      JsonMapper.ToJson(model);
      Assert.NotNull(model);
  }

Max allowed object depth reached while trying to export from type System.DateTimeOffset

Infinite recursion here: https://github.com/aws/aws-xray-sdk-dotnet/blob/master/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs#L828

This is most likely same issue as #202

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions