title: contains cycles and cannot be serialized if reference tracking is disabled, json.net and webapi
body: <p>I'm getting the error:</p>
  
  <pre><code> Object graph for type 'System.Collections.Generic.List`1[[Proj.Model.Prom, Proj.Model, 
   Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' contains cycles and cannot be 
   serialized if reference tracking is disabled.
  </code></pre>
  
  <p>Reading about that, seems to be the serializer, but Json.Net claims to be the solution and I've read WebApi and Framework 4.5 has it by default. So Is it coming by default? If so, Why I'm still getting that error? </p>
  
  <p>Thanks! Guillermo.</p>
  
  <p>EDIT: Adding code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data.Spatial;
  
  namespace Proj.Model
  {
      public class Prom
      {
          public Prom()
          {
              this.Stores = new List&lt;Store&gt;();
              this.Branches = new List&lt;Branch&gt;();
              this.Products = new List&lt;Product&gt;();
          }
  
          public int Id { get; set; }
          public string Name { get; set; }
          public DbGeography Location { get; set; }
          public string Latitude { get; set; }
          public string Longitude { get; set; }
          public int StateId { get; set; }
          public int CategoryId { get; set; }
  
          public virtual ICollection&lt;Store&gt; Stores { get; set; }
          public virtual ICollection&lt;Branch&gt; Branches { get; set; }
          public virtual ICollection&lt;Product&gt; Products { get; set; }
  
          public virtual Category Category { get; set; }
          public virtual State  State  { get; set; }
  
      }
  }
  
  using System;
  using System.Collections.Generic;
  
  namespace Proj.Model
  {
      public class Category
      {
          public Category()
          {
              this.Proms = new List&lt;Prom&gt;();
          }
  
          public int Id { get; set; }
          public string Name { get; set; }
          public string Description { get; set; }
  
          public virtual ICollection&lt;Prom&gt; Proms { get; set; }
      }
  }
  </code></pre>
  
  <p>Then running something like this returns the error</p>
  
  <pre><code>public IEnumerable&lt;Category&gt; GetList(int estadoId, string idTiposTarjetasList)
  {
      var ids = "1,2,3,4".Split(',');
      var intIds = ids.Select(int.Parse);
  
      var Categories = Uow.Categorias.GetAllIncluding(c =&gt; c.Proms).ToList();
      foreach (var category in Categories)
      {
          var proms = category.Proms.Where(p =&gt; intIds.Contains(p.Id) &amp;&amp; p.StateId == stateId).ToList();
          category.Proms = proms;
      }
      return Categories
  }
  </code></pre>