U4-3588 - Value cannot be null. Parameter name: child error when using the Login Macro

Created by Richard Soeteman 19 Nov 2013, 11:01:24 Updated by Shannon Deminick 21 Nov 2013, 00:12:25

Using Umbraco V7 Nightly Build 166 installed the txt starterkit and adding a login form to a view The exception as shown below is thrown. The Login form is a Partial View Macro based on the Login template when creating the Macro.

Attached the view and the Partials Macro view

Server Error in '/' Application. Value cannot be null. Parameter name: child 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.ArgumentNullException: Value cannot be null. Parameter name: child

Source Error:

Line 27: @CurrentPage.BodyText Line 28: @Umbraco.RenderMacro("LoginStatus") Line 29: @Umbraco.RenderMacro("Login") Line 30: Line 31:

Source File: f:\sites\umbracov7\Views\umbTextPage.cshtml Line: 29

Stack Trace:

[ArgumentNullException: Value cannot be null. Parameter name: child] System.Web.UI.ControlCollection.Add(Control child) +12265230 Umbraco.Web.UmbracoHelper.RenderMacro(macro m, IDictionary2 parameters, page umbracoPage) +568 ASP._Page_Views_umbTextPage_cshtml.Execute() in f:\sites\umbracov7\Views\umbTextPage.cshtml:29 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +128 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181 Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in f:\TeamCity\buildAgent\work\e1a0ddf7a1349eaf\src\Umbraco.Core\Profiling\ProfilingView.cs:24 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +398 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +649 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +649 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +287 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +736 System.Web.Mvc.<>c__DisplayClass1d.b__19() +49 System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +15 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53 System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +51 System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440

2 Attachments

Download umbTextPage.cshtml

Download Login.cshtml


Shannon Deminick 20 Nov 2013, 06:36:15

Which page did you get this exception on ? I can't seem to reproduce this currently.

Richard Soeteman 20 Nov 2013, 06:53:32

Can't reproduce this either on the latest nightly, maybe It was all related to the xml error?

Shannon Deminick 20 Nov 2013, 06:55:02

maybe, dunno :) will close

Richard Soeteman 20 Nov 2013, 12:58:54

Still get this issue but it's related to Macro's and really weird it works at first then after an amount of time only editing content All Partial Macro's fail to execute

Sebastiaan Janssen 20 Nov 2013, 14:17:57

Can repro now:

  • Developer > Partial View Macros > Create (and create macro is checked on) > No need to choose a specific snippet.
  • Open up the macros tree, find the one you just created, looks good, there's a partial view file selected
  • Insert the macro on a template
  • Go to the page with the macro on it, all good
  • Touch the web.config, reload that page: BOOM
  • Open up the macros tree - there's no files anywhere under "CHOOSE A FILE TO RENDER".

So something is going wrong when saving that macro from the Partial View Macros "create macro" checkbox.

If you save the macro once from the macro's tree this problem doesn't occur at all.

Shannon Deminick 21 Nov 2013, 00:00:16

The issue is in umbraco.PartialViewMacroTasks it is missing a Save() call on the legacy macro object so it's not persisting the value.

Shannon Deminick 21 Nov 2013, 00:02:05

There's a few places in the core that is missing this Save() call so will fix them up too. Previously the Save() call wasn't required just like the old legacy content/media/etc... APIs but with these wrapping the new APIs, Save() is required.

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.0.0

Due in version:


Story Points: