Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Item has already been added" error in Experience Editor mode and custom parameters #414

Open
Amir818 opened this issue Aug 3, 2020 · 0 comments

Comments

@Amir818
Copy link

Amir818 commented Aug 3, 2020

Glass.Mapper.Sc version 5.6.160.0 running on Sitecore 9.2.

If you have a markup similar to this (in this case, used for dynamic lazy-loaded images), when the "isEditable" is true, in experience editor, you get the error shown.

@Html.Glass().RenderImage(Model, x => x.RollupLargeImage, new { @Class = "fluid-img", data_srcset = "/sitecore/shell/-/media/experience-explorer/presets/field-320--435.jpg?la=en 1200w, /sitecore/shell/-/media/experience-explorer/presets/field-320--435.jpg?la=en 992w, /sitecore/shell/-/media/experience-explorer/presets/field-320--435.jpg?la=en 576w"}, isEditable: true)

The above is the final rendered url for the parameters. I've shown it that way so that the ?la=en is visible. The original razor markup is this:

@Html.Glass().RenderImage(Model, x => x.RollupLargeImage, new { @Class = "fluid-img", data_srcset = $"{Model.RollupLargeImage.Src} 1200w, {Model.RollupLargeImage.Src} 992w, {Model.RollupLargeImage.Src} 576w" }, isEditable: true)

Item has already been added. Key in dictionary: 'la' Key being added: 'la'

 at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at Sitecore.Pipelines.RenderField.GetImageFieldValue.ConfigureRenderer(RenderFieldArgs args, ImageRenderer imageRenderer)
   at Sitecore.Pipelines.RenderField.GetImageFieldValue.Process(RenderFieldArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Glass.Mapper.Sc.GlassHtml.MakeEditable[T](Expression`1 field, Expression`1 standardOutput, T model, Object parameters, Context context, Database database, TextWriter writer) in C:\TeamCity\buildAgent\work\9693a2d38f55a4a\Source\Glass.Mapper.Sc\GlassHtml.cs:line 594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant