+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / NullReferenceException when calling Html.Action (Self answer)

NullReferenceException when calling Html.Action (Self answer)

1 posts, 1 answered
  1. Bo Chulindra
    Bo Chulindra avatar
    35 posts
    Registered:
    17 Dec 2013
    09 Mar 2015
    Link to this post
    One of our developers was seeing the following exception whenever Html.Action was getting called:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Sitefinity.Mvc.SitefinityMvcRoute.GetOrderedParameters(RouteValueDictionary values, Type controllerType) +311
       Telerik.Sitefinity.Mvc.SitefinityMvcRoute.GenerateVirtualPath(RouteValueDictionary values, RequestContext requestContext) +453
       Telerik.Sitefinity.Mvc.SitefinityMvcRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +262
       System.Web.Routing.RouteCollection.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +96
       System.Web.Mvc.RouteCollectionExtensions.GetVirtualPathForArea(RouteCollection routes, RequestContext requestContext, String name, RouteValueDictionary values, Boolean& usingAreas) +257
       System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +221
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +83
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, Object routeValues) +45



    When we debugged the code, it ended up being because SitefinityMvcRoute could not resolve a controller type by its name.

    After looking in the Sitefinity error log, we saw an additional error that we thought was odd:

    Access to the path 'C:\Plastic\MyProject\App_Data\Sitefinity\Configuration\ToolboxesConfig.config' is denied.

    We discovered that the ToolboxesConfig.config file was being set to read-only by Plastic SCM and this was causing that error. When we changed the Plastic SCM configuration so that it would not set files to read-only, both errors were resolved. Html.Action worked correctly.
    Answered
1 posts, 1 answered