Pages

Tuesday, September 29, 2009

Sitecore CMS 6 - IndexOutOfRangeException from Sitecore.Shell.Applications.Security.UserManager

Something odd has occurred to my Sitecore 6 install. I've started getting the following exception from the Security Tools > User Manager:

Exception: System.IndexOutOfRangeException
Message: Index was outside the bounds of the array.
Source: ComponentArt.Web.UI
   at ComponentArt.Web.UI.GridItem.set_Item(Object obj, Object value)
   at Sitecore.Shell.Applications.Security.UserManager.UserManager.Users_ItemDataBound(Object sender, GridItemDataBoundEventArgs e)
   at ComponentArt.Web.UI.Grid.ItemDataBoundEventHandler.Invoke(Object sender, GridItemDataBoundEventArgs e)
   at ComponentArt.Web.UI.Grid.LoadGridItems(GridItemCollection arItems, Object[] arObjects, Int32 iLevel)
   at ComponentArt.Web.UI.Grid.DataBindToEnumerable(IEnumerable arList)
   at ComponentArt.Web.UI.Grid.DataBind()
   at Sitecore.Web.UI.Grids.ComponentArtGridHandler`1.DataBind()
   at Sitecore.Web.UI.Grids.ComponentArtGridHandler`1.InitializeGrid(Boolean dataBind)
   at Sitecore.Web.UI.Grids.ComponentArtGridHandler`1..ctor(Grid grid, IGridSource`1 source, Boolean dataBind)
   at Sitecore.Web.UI.Grids.ComponentArtGridHandler`1.Manage(Grid grid, IGridSource`1 source, Boolean dataBind)
   at Sitecore.Shell.Applications.Security.UserManager.UserManager.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Using reflector I found the code in question:

private void Users_ItemDataBound(object sender, GridItemDataBoundEventArgs e)
{
    e.Item["Profile.PortraitFullPath"] = Themes.MapTheme((e.DataItem as User).Profile.Portrait);
}

There appears to be an issue with the Portrait profile profile property not existing for the GridItem.


Turns out the issue was caused by the aspx files under \sitecore\ in the web site being out of sync with the Sitecore DLLS. In particular, I had Sitecore.Client.dll (6.0.1.2906) and an out of date version of \sitecore\shell\Applications\Security\UserManager\UserManager.aspx. I believe this can about by trying to keep Sitecore under TFS source control. At some point an update package was installed but the changes to the sitecore folder never found their way into source control.

No comments:

Post a Comment