U4-3529 - YSOD editing partial view Macro or adding a macro to a template when teh selected macro doesn't have parameters

Created by Richard Soeteman 14 Nov 2013, 13:47:18 Updated by Shannon Deminick 21 Jun 2017, 07:58:45

When the selected Macro doesn't contain any parameters the following exception is thrown in Umbraco when editing the Partial View or adding it to a template. It's because of a recent change to PetaPoco from SqlHelper where select 1 from cmsMacroProperty where macro = {0} will return null and can't be converted in PetaPoco to a type.

Server Error in '/' Application. Null object cannot be converted to a value type. 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.InvalidCastException: Null object cannot be converted to a value type.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Null object cannot be converted to a value type.] System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +14000773 Umbraco.Core.Persistence.Database.ExecuteScalar(String sql, Object[] args) in f:\TeamCity\buildAgent\work\e1a0ddf7a1349eaf\src\Umbraco.Core\Persistence\PetaPoco.cs:577 Umbraco.Web.UI.Controls.InsertMacroSplitButton.DoesMacroHaveParameters(Int32 macroId) +127 Umbraco.Web.UI.Controls.InsertMacroSplitButton.CreateChildControls() +564 System.Web.UI.Control.EnsureChildControls() +189 System.Web.UI.Control.InitRecursive(Control namingContainer) +186 System.Web.UI.Control.AddedControl(Control control, Int32 index) +189 umbraco.uicontrols.ScrollingMenu.OnLoad(EventArgs e) in f:\TeamCity\buildAgent\work\e1a0ddf7a1349eaf\src\umbraco.controls\ScrollingMenu.cs:152 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Comments

Shannon Deminick 21 Jun 2017, 07:58:46

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/


Priority: Normal

Type: Bug

State: Closed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.0.0

Due in version:

Sprint:

Story Points:

Cycle: