Full stop full stop

Time:2021-12-4

Question: self referencing loop detected for property ‘value’ with type ‘xxx’. Path ‘

Scenario: when using release in the. Net core environment, an error occurs when calling the appsettings.json file. The error content is as follows.

The source code is as follows:

    Startup:services.Configure(_configuration.GetSection(“xxx”));

    public class TestClass : IOptions

    {
      public TestClass Value => this;

      public double Lng { get; set; }

    }

Now the object is changed to the following to solve the problem:

    public class TestClass : IOptions

    {

      [JsonIgnore]

      public TestClass Value => this;

      public double Lng { get; set; }

    }

 

If you have any questions, please consult: