Strange IE error: StartIndex cannot be less than zero.

Nov 1, 2011 at 9:40 AM

I've got this strange situation that an application that we've deployed on an IIS7.5 server throws an error in Internet Explorer. It works fine with FF and Chrome and have worked in IE. Locally IE also works fine.

Below is an output of the error. Perhaps someone has a clue?

Thanks,

Jeroen

Error in: /SimpleRepository/Action/AllInstances?id=NakedObjects.Services.SimpleRepository%601-org.estatio.pms.model.Country%3B1%3BSystem.Int32%3B0%3BFalse%3B%3B0 error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

StartIndex cannot be less than zero.
Parameter name: startIndex
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex]
   System.String.Remove(Int32 startIndex) +6576122
   NakedObjects.Web.Mvc.Models.ObjectAndControlData.GetName(String nameValue) +172
   System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +234
   System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector) +90
   NakedObjects.Web.Mvc.Models.ObjectAndControlData.get_DataDict() +905
   NakedObjects.Web.Mvc.Controllers.NakedObjectsController.GetPageSize(ObjectAndControlData controlData) +80
   NakedObjects.Web.Mvc.Controllers.NakedObjectsController.CurrentlyPaging(ObjectAndControlData controlData, Int32 collectionSize, Int32& page, Int32& pageSize) +97
   NakedObjects.Web.Mvc.Controllers.NakedObjectsController.Page(INakedObject nakedObject, ICollectionFacet collectionfacet, Int32 collectionSize, ObjectAndControlData controlData, Boolean forceEnumerable) +110
   NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.AppropriateView(ObjectAndControlData controlData, INakedObject nakedObject, String propertyName) +1350
   NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.ExecuteAction(ObjectAndControlData controlData, FormCollection form, INakedObject nakedObject, INakedObjectAction action) +1083
   NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.InitialAction(ObjectAndControlData controlData, FormCollection form) +478
   NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.Action(ObjectAndControlData controlData, FormCollection form) +495
   org.estatio.pms.mvc.Controllers.GenericController.Action(ObjectAndControlData controlData, FormCollection form) in C:\Users\jvanderwal\Documents\Visual Studio 2010\Projects\EstatioPMS-trunk\org.estatio.pms.mvc\Controllers\GenericController.cs:47
   lambda_method(Closure , ControllerBase , Object[] ) +181
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +125
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +640
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691
   System.Web.Mvc.Controller.ExecuteCore() +162
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +305
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Coordinator
Nov 1, 2011 at 9:51 AM

Not obvious to me.  Two suggestions to help pin it down:

1.  Please confirm which version of IE it is where the problem appears.

2.  Might be useful to establish whether this is caused by an Ajax interaction (which I suspect).  Worth trying with the Ajax switched off -  obviously that's not a solution but it might help pin down the problem.

Richard 

Editor
Nov 1, 2011 at 9:54 AM


On 1 November 2011 08:51, richardpawson <notifications@codeplex.com> wrote:


1. Please confirm which version of IE it is where the problem appears.

As an fyi, a good tool to help with this is ietester (http://www.my-debugbar.com/wiki/IETester/HomePage)... supports IE 5.5 through 9.

Dan


Nov 1, 2011 at 10:19 AM

Thanks, I've should have been more clear:

- It appears in both version 8 & 9 of Internet Explorer. (the only versions I have at hand, will look into IETester);

- It is definately an Ajax error; also a popop windows opens saying "Ajax Error";

- It appears when I open any menu option;

- Somewhere in te development process it has been broken because it worked before. But reverting to previous a checkin does not make the issue dissapear.

Will now start digging into IIS logs...

Thanks,

Jeroen

Nov 1, 2011 at 4:02 PM

I keep my head banging to the wall on this issue. I forgot to mention that without modifying the SystemController I get this message:

The default .css supplied with Naked Objects MVC will not render correctly with IE6 or IE7 - because of the use of drop-down menus. Please use IE8, Google Chrome, or Firefox - or provide your own .css (in which case remove this check from SystemController:OnActionExecuting).

It seems like my IIS is not getting the right version of the browser since all browsers I used are either IE8 or IE9. I discovered that it's NOT related to AJAX; I disabled that and the error still appears.

I'l keep digging...

-Jeroen

Coordinator
Nov 1, 2011 at 4:43 PM

Is it possible that you are running the browser in compatibility mode i.e. you are accidentally emulating IE6 or 7? 

This would explain why you were getting that message. Lots of corporate browsers are configured to run in compatibility mode.

You can switch it off for individual sites.

Nov 1, 2011 at 5:20 PM

In the last few minutes I've recited all the curses I know... This did the trick;

Goto "Page>Compatibility View Settings" and disable the option "Display Intranet sites in Compatibily view"

I owe you one Richard!

-Jeroen