DynamicContentPlugin generates out of bounds exception

Vote:
 

Hi,

I'm trying to create a very simple dynamiccontentplugin but when I've added it to the page and click on the publish button I get an error:

"Index was outside the bounds of the array."

Stack trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   EPiServer.DynamicContent.DynamicContentBase.set_State(String value) +341
   EPiServer.DynamicContent.DynamicContentFactory.CreateDynamicContent(String name, String state, String hash, Boolean validateHash) +62
   EPiServer.Core.Html.StringParsing.DynamicContentFragment..ctor(IDynamicContentFactory factory, ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator, String dynamicClass, String state, String hash, Boolean evaluateHash) +82
   EPiServer.Core.Html.StringParsing.FragmentParser.ExtractDynamicContentFromElement(HtmlFragmentData fragmentData, ElementFragment element) +371
   EPiServer.Core.Html.StringParsing.FragmentParser.TryToExtractDynamicContent(HtmlFragmentData fragmentData, ElementFragment element) +147
   EPiServer.Core.Html.StringParsing.FragmentParser.ParseElement(HtmlFragmentData fragmentData, ElementFragment element) +31
   EPiServer.Core.Html.StringParsing.FragmentParser.ProcessFragments(HtmlFragmentData fragmentData, Boolean returnOnEndElement) +318
   EPiServer.Core.Html.StringParsing.FragmentParser.Parse(String html, FragmentParserMode parserMode, Boolean evaluateHash) +194
   EPiServer.UI.Editor.Dialogs.DynamicContentPreview.CreateDynamicContentPreview(String textContents) +49
   EPiServer.UI.Editor.Dialogs.DynamicContentPreview.OnInit(EventArgs e) +302
   System.Web.UI.Control.InitRecursive(Control namingContainer) +143
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1477

Any ideas on how to resolve this? This feature should work out of the box without any problems.

 

#71368
May 16, 2013 13:53
Vote:
 

Apparently the exception was thrown because I hadn't added any properties to the class.

When I added, for example,

public string MyProperty { get; set; }

there was no error.

Seems weird that you have to have at least one property to get the dynamic content to work properly...

#71413
May 17, 2013 10:27
Vote:
 

Now this is an interesting feature. What if I don't need any properties...?

#76893
Nov 05, 2013 16:48
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.