"Object reference not set to an instance of an object." when setting child theme of bootstrap as current theme.

Topics: General
Aug 12, 2013 at 8:43 AM
I've downloaded Bootstrap theme By Raptor Concepts ,Version: 2.3.2.1.
I've created child theme which has base theme of bootstrap. It's working fine if I click on "Preview" button in gallery. When I set as current theme, It's throwing below error.

"Object reference not set to an instance of an object."


What could be the problem? What are the things that I'm still missing?
Coordinator
Aug 12, 2013 at 8:19 PM
No way to know without a stack trace.
Aug 13, 2013 at 4:53 AM
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


[No relevant source lines]


Source File: c:\Users\XYZ\AppData\Local\Temp\Temporary ASP.NET Files\orchardlocal\d65d1f89\44e57871\App_Web_05njrhbf.9.cs    Line: 0

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_Themes_Bootstrap_Views_User_cshtml.Execute() in c:\Users\XYZ\AppData\Local\Temp\Temporary ASP.NET Files\orchardlocal\d65d1f89\44e57871\App_Web_05njrhbf.9.cs:0
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +32
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) +273
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) +160
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) +142
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) +218
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) +1737
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) +264
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) +204
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) +129
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +255
   CallSite.Target(Closure , CallSite , Object , Object ) +527
   Orchard.Core.Shapes.CoreShapes.Zone(Object Display, Object Shape, TextWriter Output) +3122

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) +281
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.<>c__DisplayClass4.<CreateDelegate>b__3(DisplayContext context) +168
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) +142
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) +218
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) +1737
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) +264
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) +204
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) +129
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   ASP._Page_Themes_Bootstrap_Views_Layout_cshtml.<Execute>b__b5(Object x) in f:\Orchard\Orchard.Source.1.7\src\Orchard.Web\Themes\Bootstrap\Views\Layout.cshtml:21
   CallSite.Target(Closure , CallSite , Func`2 , Object ) +184
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +685
   ASP._Page_Themes_Bootstrap_Views_Layout_cshtml.Execute() in f:\Orchard\Orchard.Source.1.7\src\Orchard.Web\Themes\Bootstrap\Views\Layout.cshtml:97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +32
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) +273
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) +160
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) +142
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) +218
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) +1737
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) +264
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) +204
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) +129
   CallSite.Target(Closure , CallSite , Object , Object ) +371
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +685
   Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) +1552
   Orchard.Mvc.ViewEngines.ThemeAwareness.LayoutView.Render(ViewContext viewContext, TextWriter writer) +107
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +295
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResul
Coordinator
Aug 13, 2013 at 6:24 AM
What's on this line of code?

f:\Orchard\Orchard.Source.1.7\src\Orchard.Web\Themes\Bootstrap\Views\Layout.cshtml line 97
Aug 13, 2013 at 8:16 AM
Edited Aug 13, 2013 at 8:16 AM
<div class="subnav" id="main-menu">
                    @if (Model.Navigation != null) {
                        @Zone(Model.Navigation)
                    }
                </div>
Coordinator
Aug 17, 2013 at 6:59 AM
Attach a debugger and figure out what's null.
Sep 23, 2013 at 10:07 PM
Edited Sep 23, 2013 at 10:08 PM
i have the same exact issue.
dharmik_bhandari: how did you resoved it?
thanks
andy
Sep 23, 2013 at 11:20 PM
yes , line 97 @Zone(Model.Navigation) got null ex
Developer
Sep 24, 2013 at 12:20 AM
Edited Sep 24, 2013 at 12:21 AM
The stack trace clearly shows that error is here: ASP._Page_Themes_Bootstrap_Views_User_cshtml.Execute(). In other words - there's something wrong inside the file Themes/Bootstrap/Views/User.cshtml.
Sep 24, 2013 at 2:12 AM
pszmyd: u r right .

i changed user.cshtml to

@using System.Web.Mvc;
<ul class="nav @(WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_FIXED_NAV] != null && WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_FIXED_NAV] == bool.TrueString ? string.Empty : "nav-pills") pull-right" style="margin-top: @(WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_FIXED_NAV] != null && WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_FIXED_NAV] == bool.TrueString ? "0" :WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_SWATCH_NAME] !=null && WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_SWATCH_NAME].ToString() == "journal.min.css" ? "-54px" : WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_SWATCH_NAME] !=null && WorkContext.HttpContext.Items[Bootstrap.Constants.ITEM_USE_SWATCH_NAME].ToString() == "simplex.min.css" ? "-38px" : "-36px;")">
@if (WorkContext.CurrentUser != null) {
    <li class="dropdown">
        <a href="#" id="userDropdown" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i>&nbsp;@Html.ItemDisplayText(WorkContext.CurrentUser) <b class="caret"></b></a>
        <ul class="dropdown-menu" role="menu" aria-labelledby="userDropdown">
            <li>@Html.ActionLink(T("Change Password").ToString(), "ChangePassword", new { Controller = "Account", Area = "Orchard.Users" })</li>
            <li>@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }, new { rel = "nofollow" })</li>
            @if (AuthorizedFor(Orchard.Security.StandardPermissions.AccessAdminPanel)) {
                <li class="divider"></li>
                <li>@Html.ActionLink(T("Dashboard").ToString(), "Index", new { Area = "Dashboard", Controller = "Admin" })</li>
            }
        </ul>
    </li>
}
else {
    <li>@Html.ActionLink(T("Sign In").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = (Request.QueryString["ReturnUrl"] ?? Request.RawUrl) }, new { rel = "nofollow" })</li>
}

</ul>