Value cannot be null Parameter name objectToSwitchTo - Glassmapper Rendering parameters

Tags:     sitecore8.1, Rendering Parameters, GlassMapper, Sitecore


Page Editable Rendering Parameters


We are on Sitecore 8.1 update 3 and using the latest release of Glassmapper ( When we try to use @Editable it works for data source items. But not for rendering parameters.

in .cshtml we have below code:

 var rp = GetRenderingParameters<IEditorialComponent>();
 @Html.Glass().Editable(rp, x => x.Heading) @Editable(rp, x => x.Heading)


Both ways are not working, in page editor mode and getting below error:

Value cannot be null. Parameter name: objectToSwitchTo
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) at Sitecore.Common.Switcher 2.Enter(TValue objectToSwitchTo)
at Glass.Mapper.Sc.GlassHtml.MakeEditable[T](Expression`1 field, Expression 1 standardOutput, T model, Object parameters, Context context, Database database, TextWriter writer) in \Glass.Mapper.Sc\GlassHtml.cs:line 582


Rendering Parameters class:

[SitecoreType(TemplateId = "{templateId}")]
public partial interface IEditorialComponent : IGlassBase 
    [SitecoreField(FieldId = "FieldId")]
     string Body { get; set; }



Sitecore does not support making rendering parameters editable via the page editor in the same way as fields. You have to edit rendering parameters by using the rendering properties window.

Therefore Glass doesn't support this either.

I get to know about this by raising a question in StackOverflow link here