We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Null Pointer Exception : SerializeToJson(Object inputObject)

Thread ID:





123238 Feb 29,2016 09:28 AM UTC Mar 2,2016 12:50 PM UTC ASP.NET MVC 3
Tags: Diagram
aymen drine
Asked On February 29, 2016 09:28 AM UTC

i am traying to implement Synchfusion Diagram. I tried to follow the steps indicated in the tutorial ( http://www.syncfusion.com/downloads/support/forum/119501/ze/Create_Your_First_Diagram_in_MVC-43006509 ).
Unfortunately the following Exception keeps raising:
   L'exception System.NullReferenceException n'a pas été gérée par le code utilisateur
  Message=La référence d'objet n'est pas définie à une instance d'un objet.
       à Syncfusion.JavaScript.Shared.Serializer.SerializeObject.SerializeToJson(Object inputObject)
       à Syncfusion.JavaScript.Shared.Serializer.SerializeObject.SerializeToJson(Object input, String ID)
       à Syncfusion.JavaScript.Control.Serialize(Object model)
       à Syncfusion.JavaScript.Control.RenderJson()
       à Syncfusion.JavaScript.Control.Raw()
       à Syncfusion.JavaScript.Control.ToHtmlString()
       à System.Web.HttpUtility.HtmlEncode(Object value)
       à System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content)
       à System.Web.WebPages.WebPageBase.Write(Object value)
       à ASP._Page_Views_Diagram_RenderDiagram_cshtml.Execute() dans c:\Users\administrateur\Desktop\*********\FS_RH\FS_RH_PL\Views\Diagram\RenderDiagram.cshtml:ligne 15
       à System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       à System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       à System.Web.WebPages.StartPage.RunPage()
       à System.Web.WebPages.StartPage.ExecutePageHierarchy()
       à System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       à System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
       à System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
       à System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       à System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
       à System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       à System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)

I am using .NET MVC 5 in my project. My code (Controller and View) are attached.

Thank you.

Attachment: View__Controller_Synchfusion_Diagram_b4097b61.rar

Shyam G [Syncfusion]
Replied On March 1, 2016 12:56 PM UTC

Hi Aymen,

The reported issue occurs only if the viewData(ViewData["diagramModel"]) value is null in the view page(.cshtml page) as highlighted in the below code example. So please check in the below sample and get back to us if you are still facing issues at your end.

Code example:

@Html.EJ().Diagram("DiagramContent", ViewData["diagramModel"] as DiagramProperties)


Shyam G

aymen drine
Replied On March 1, 2016 04:54 PM UTC

Hi Shyam G,
I checked the ViewData value and it's not Null.

        @{ var s = ViewData["diagramModel"];}
        @Html.EJ().Diagram("Diagram1", s as DiagramProperties)
Please check
the below Attachment:

Attachment: SyncfusionMvcApplication6_4f675505.rar

Shyam G [Syncfusion]
Replied On March 2, 2016 12:50 PM UTC

Hi Aymen,

In your sample, we got the compilation error due to misspelling of the ViewData in the controller page(DiagramController.cs). you have set as ViewDataData instead of using ViewData. We have modified it correctly in your sample and provided below. Still if an issue occurs at your end, please provide us more details such as video and screenshot of controller, cshtml page. So that we can analyze further and provide a better solution. Please refer to the sample and video below.

Sample: http://www.syncfusion.com/downloads/support/forum/123238/ze/SyncfusionMvcApplication6272299172


Shyam G


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon