- Home
- Forum
- ASP.NET Web Forms
- A circular reference was detected while serializing an object of type 'System.Reflection.RuntimeModule'.
A circular reference was detected while serializing an object of type 'System.Reflection.RuntimeModule'.
I'm getting this error message, "A circular reference was detected while serializing an object of type 'System.Reflection.RuntimeModule'. " when i change the DataSourceCachingMode to "ViewState".
Stack Trace:
[InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Reflection.RuntimeModule'.]
System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2533 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +186 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2699 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +186 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2699 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +775 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +2751 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +372 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat) +57 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat) +82 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj) +44 Syncfusion.JavaScript.Web.DropDownList.SaveViewState() +93 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +93 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +324 System.Web.UI.Page.SaveAllState() +568 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5314
SIGN IN To post a reply.
3 Replies
KR
Keerthana Rajendran
Syncfusion Team
June 21, 2016 12:26 PM UTC
Hi Danferd,
Thank you for contacting Syncfusion support we have tried a dropdown sample with DataSourceCachingmode:ViewState but we were unable to reproduce the issue in our end.
Please refer the below given sample link:
Can you please share some more details to reproduce the issue or modify our sample and attach in your next update so that we could analyze the issue and provide solution as soon as possible
Regards,
Keerthana.
DL
Danferd Lan
July 1, 2016 03:14 AM UTC
I was binding the control with the datatable and had the DataSourceCachingmode=ViewState, could it be the cause?
KR
Keerthana Rajendran
Syncfusion Team
July 1, 2016 06:44 AM UTC
Hi Danferd,
We were able to reproduce the issue in our end. The issue is because of JavaScriptSerializer. JavaScriptSerializer is not able to convert the DataTable to JSON array directly that results with the circular reference error. To overcome, this error we suggest you to convert the DataTable to IEnumerable list when assigning it to DataSource property.
For further references check the following links:
https://social.msdn.microsoft.com/Forums/en-US/da0bedf1-9299-4518-9d89-bc54edbe3e24/datatable-serialization-circular-reference-error?forum=asmxandxml
http://stackoverflow.com/questions/30684514/a-circular-reference-was-detected-while-serializing-an-object-of-type-system-re
http://forums.asp.net/t/1642962.aspx?Can+JsonResult+method+return+Data+Table+
https://social.msdn.microsoft.com/Forums/en-US/da0bedf1-9299-4518-9d89-bc54edbe3e24/datatable-serialization-circular-reference-error?forum=asmxandxml
http://stackoverflow.com/questions/30684514/a-circular-reference-was-detected-while-serializing-an-object-of-type-system-re
http://forums.asp.net/t/1642962.aspx?Can+JsonResult+method+return+Data+Table+
We have prepared sample with the suggested workaround. Please refer the below given link:
Regards,
Keerthana.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DL Danferd Lan
- Jun 20, 2016 09:10 AM UTC
- Jul 1, 2016 06:44 AM UTC