Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dominik 711 posts 733 karma points
    Jan 02, 2013 @ 13:26
    dominik
    0

    Razor Script Index was outside the bounds of the array

    Since some days we are getting the following issue for some of our razor macros (not all)

    Index was outside the bounds of the array

    Any idea how this can happen?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 02, 2013 @ 13:53
    Lee Kelleher
    0

    Hi dominik,

    Are you able to provide an example code snippet?  We might be able to pinpoint the cause of the error.

    Thanks, Lee.

  • dominik 711 posts 733 karma points
    Jan 02, 2013 @ 14:59
    dominik
    0

    Hi Lee,

    Here is one of the script which is creating this issue.

    The funny thing is that the same code was working before and is working on another instance.

    @if(@Model.headerImage.ToString() != "") {

      <div id="top-" style="background:red;background-image: url(@Model.Media("headerImage","umbracoFile"));background-repeat: no-repeat;"></div>

    } else if(@Model.menuClass.ToString() != "") {

     <div id="[email protected]">&nbsp;</div> 
    } else {

     <div id="top-service-corner">&nbsp;</div>

    }

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 02, 2013 @ 15:02
    Lee Kelleher
    0

    Hi dominik,

    At a glance your code snippet looks fine (as you said, it was working before).  Usually the index errors are do to with using array, but your code doesn't do anything with those... so not sure what the cause might be. :-(

    - Lee

  • dominik 711 posts 733 karma points
    Jan 02, 2013 @ 15:08
    dominik
    0

    is this an MsSQL problem? 

    THe stack trace is showing the following:

    Error Loading Razor Script (file: Header Image) Index was outside the bounds of the array.    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
      at umbraco.cms.businesslogic.ContentType.GetDataType(String contentTypeAlias, String propertyTypeAlias)
      at umbraco.cms.businesslogic.ContentType.GetDataType(String contentTypeAlias, String propertyTypeAlias)
      at umbraco.MacroEngines.DynamicNode.TryGetMember(GetMemberBinder binder, Object& result)
      at CallSite.Target(Closure , CallSite , Object )
      at ASP._Page_macroScripts_HeaderImage_cshtml.Execute() in c:\inetpub\EBE\macroScripts\HeaderImage.cshtml:line 1
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

  • dominik 711 posts 733 karma points
    Jan 07, 2013 @ 08:38
    dominik
    0

    HI Lee,

    Now the macros are working again without touching any file.

    For me it looks like a database problem but how can we ensure that this will not happen any more in the future?

     

    Thanks

  • Ben McKean 272 posts 549 karma points
    Jan 17, 2013 @ 11:19
    Ben McKean
    0

    Hi

    We've just had a very similar problem to this. In happened last night. The site in question gets many visitors and there the number of requests caused the website to go down. We restarted the app pool this morning and it resolved the issue. The site was down for 5 hours. The is built in v4.9.1

    The site is a pretty high profile site for us so any help would be greatly appreciated so we can find the problem and fix. The error message in the log table is:

    (Referred by: ): System.IndexOutOfRangeException: Index was outside the bounds of the array.     at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)     at umbraco.cms.businesslogic.ContentType.GetDataType(String contentTypeAlias, String propertyTypeAlias)     at umbraco.MacroEngines.DynamicNode.TryGetMember(GetMemberBinder binder, Object& result)     at CallSite.Target(Closure , CallSite , Object )     at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)     at WCSiteMaster.Page_Load(Object sender, EventArgs e)     at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Thanks

    Ben

  • Adam Nelson 27 posts 186 karma points c-trib
    Mar 09, 2013 @ 23:04
    Adam Nelson
    0

    Same thing is happening to my high-activity site - scheduled app pool recycles sometimes cause Umbraco to have internal issues and I get the same exception. Note an application pool recycle normally fixes it as it seems to be a thread race-condition issue. I'm running 4.8.0 (and Ben is running 4.9.1) but I can see the same code causing the issue is still there in 4.11.5.

    I've raised U4-1874 at http://issues.umbraco.org/issue/U4-1874

     

  • Graeme Leggate 3 posts 24 karma points
    Mar 26, 2013 @ 10:34
    Graeme Leggate
    1

    Great to find this, I thought I'd been going mad. Adam, I'm having the exact same problem, although our site isn't particuarily high traffic. As you say, it only happens when the app pool recycles, but I can go days/weeks without it happening, then it'll pop up again.For reference, I'm running 4.11.1.

    As above, I'm getting the "Index was out of bounds" error repeatedly until I manually recycle the app pool which fixes it.

     


  • Adam Nelson 27 posts 186 karma points c-trib
    Mar 26, 2013 @ 10:37
    Adam Nelson
    0

    Yeah, a race condition is just that - can happy anytime. Please vote for the issue at http://issues.umbraco.org/issue/U4-1874 :-)

    Thanks.

  • Graeme Leggate 3 posts 24 karma points
    Apr 11, 2013 @ 10:07
    Graeme Leggate
    0

    Interestingly enough I'm still experiencing this issue after disabling all caching on all macros completely (assuming setting to 0 seconds does this). I do however have pretty substantial "custom" caching of DB calls etc. but I wouldn't have thought this would have any effect on the issue at hand? I guess there is more caching goign on in Umbraco itself and not just related to the macros.

    Great to see a patch fix is on it's way though - eager to install and monitor it's effect.

     

  • Janet Kirklen 102 posts 212 karma points
    Jan 23, 2014 @ 16:44
    Janet Kirklen
    0

    Just had this same issue on a 4.7.2 site.  All macros were failing but content was rendering. So it could not have been a database issue. We are running Doc Cart and some light eCommerce on this site and it does get quite a bit of traffic. Recyling the app pool resolved this right away.  I wonder if upgrading this site would prevent this from happening again?

  • Graeme Leggate 3 posts 24 karma points
    Jan 24, 2014 @ 10:24
    Graeme Leggate
    0

    Not sure exactly what upgrade it was that fixed it (it was a while ago I had it), but my site was running 4.11.1, and was upgraded to 4.11.7 and it erradicated the problem completely. Definately would suggest an upgrade if you can.

  • Jamie Attwood 208 posts 504 karma points c-trib
    Mar 06, 2014 @ 21:51
    Jamie Attwood
    0

    I just had this issue occur on a Contour 3.0.14 form in Umbraco 6.1.6.

    The error is: "Index was outside the bounds of the array"

    <%# RenderFieldPreview(((Umbraco.Forms.Core.Field)Container.DataItem)) %>

    Interestingly there are other contour forms on the same instance that were still up and running fine while this was erroring out in the front end and the contour admin tool.

    But the same issue occurs for me every so often on another 4.7 site. Usually occurs after a Windows Update and system reboot. All the macros will error out on the site but the rest of the site functions fine. 

    In both these cases, an application pool recycle brings everthing back to life...

    Any insight on what is up here would be great... a little disconcerning when these crashes are intermittant.

    Jamie

Please Sign in or register to post replies

Write your reply to:

Draft