1
votes

Hi I am having a problem debugging an issue on a website. Everything works locally, the local and server databases are the same The strange thing about the error is that it points to my local dev machine in the error stack. Is that crazy or what, The files are published and being hosted on a server machine and the error is pointing to a line of code on my local dev box. I feel like I am losing the plot. Can someone pls help be clear the air here because this is very weird

Error in '/' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
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: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

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: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.Collections.ArrayList.get_Item(Int32 index) +10066148
   System.Collections.Specialized.NameObjectCollectionBase.BaseGet(Int32 index) +17
   System.Web.HttpFileCollection.get_Item(Int32 index) +9
   System.Web.HttpFileCollectionWrapper.get_Item(Int32 index) +18
   PitchPortal.Web.Binders.DocumentModelBinder.ValidateAndAssignPostedFile(ControllerContext controllerContext, ModelBindingContext bindingContext, Document doc) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:73
   PitchPortal.Web.Binders.DocumentModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:45
   System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +404
   System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +140
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +658084
   System.Web.Mvc.Controller.ExecuteCore() +125
   System.Web.Mvc.c__DisplayClass8.b__4() +48
   System.Web.Mvc.Async.c__DisplayClass1.b__0() +21
   System.Web.Mvc.Async.c__DisplayClass8`1.b__7(IAsyncResult _) +15
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +85
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +454
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
3
If you compile it on your local machine that's what the stack trace will show for the location in a source file. That source code might not even be on your server, you deploy the DLLs. - Ian Mercer
Stack traces are not very instructive without the source, can you post your code. You often get file refernces like that in stack traces when you deploy debug code onto other machines i think that paths of the source on the machine the compiled the dll are storedin the symbol files. - Ben Robinson

3 Answers

5
votes

The strange thing about the error is that it points to my local dev machine in the error stack. Is that crazy or what

No it is not :-) The pdb (program database file) holds the information about the files. http://msdn.microsoft.com/en-us/library/ms241903.aspx

Since you compiled it locally before deploying to the server, the PDB stores the information about your local files. It does not mean your server is talking to your development box.

0
votes

Turn off your development box, and re-run the app. Something's hitting your dev box without you realizing it.

0
votes

The stack trace references file paths based on the development machine you compiled it on. To remove these artifacts for a production server, you should compile in release mode which will not contain full debug info.