Ask your technical questions on forums or here :
ASP.NET or MVC | C# | Windows Phone
Microsoft Technology Journals by Abhimanyu K Vatsa
HOME ABOUT RAZOR BOOK SPEAKING MVC ASP.NET JQUERY VIDEOS EBOOK ARCHIVE

18 Dec 2015

Self referencing loop detected for property 'xxxx' with type 'System.Data.Entity.DynamicProxies.XXX_XXX'. Newtonsoft.Json.JsonSerializationException

This is a very common serialization exception we see when forget to use loop handling strategies in Web API.

Look at the below screenshot which you have noticed:


Now if you want to resolve this issue, you can use following code in web api configuration, here's how you can resolve this issue:

var json = config.Formatters.JsonFormatter;
json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

Here's the complete code snippet screenshot:


Hope this helps you.

No comments:

Post a Comment