Peter Posselt Vestergaard
2005-06-15 07:35:01 UTC
Hi
I have an application which I run with VS C# .Net (2003) attached and I have enabled "Break into debugger" for all types of exceptions.
My problem is that I experience a System.ArgumentOutOfRange exception which is brought up in the debugger, but only in the Main method of my application (which is a MDI form based application).
As the debugger first breaks in the Main method there is nothing to see in the call stack and the only usable information in the exception (besides the type) is that the parameter that was out of range is named 'index'.
The only code in the Main method is
Application.Run(new MyClass());
and the application has been running pretty smoothly for a while (2-15 minutes typically) so I am pretty sure that the problem is not directly in the Main method (nor in the constructor of MyClass).
I have tried putting try-catch'es every possible place in the code, but none of them is triggered.
Does anyone have any ideas of what could cause this behaviour? I enclose the error message and exception content below.
/Peter
Error message in "Microsoft Development Environment" window that pops up:
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Exception contents:
- $exception {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.ArgumentOutOfRangeException
- System.ArgumentException {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.ArgumentException
- System.SystemException {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"} System.SystemException
- System.Exception {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.Exception
System.Object {System.ArgumentOutOfRangeException} System.Object
_className null string
_COMPlusExceptionCode 0xe0434f4d int
_exceptionMethod <undefined value> System.Reflection.MethodBase
_exceptionMethodString null string
_helpURL null string
_HResult 0x80131502 int
_innerException { } System.Exception
_message "Index was out of range. Must be non-negative and less than the size of the collection." string
_remoteStackIndex 0x0 int
_remoteStackTraceString null string
_source null string
_stackTrace <undefined value> System.Object
_stackTraceString null string
_xcode 0xe0434f4d int
_xptrs 0x0 int
HelpLink null string
HResult 0x80131502 int
InnerException { } System.Exception
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
Source null string
StackTrace null string
TargetSite <undefined value> System.Reflection.MethodBase
m_paramName "index" string
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
ParamName "index" string
_rangeMessage null string
ActualValue <undefined value> System.Object
m_actualValue <undefined value> System.Object
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
RangeMessage "Specified argument was out of the range of valid values." string
I have an application which I run with VS C# .Net (2003) attached and I have enabled "Break into debugger" for all types of exceptions.
My problem is that I experience a System.ArgumentOutOfRange exception which is brought up in the debugger, but only in the Main method of my application (which is a MDI form based application).
As the debugger first breaks in the Main method there is nothing to see in the call stack and the only usable information in the exception (besides the type) is that the parameter that was out of range is named 'index'.
The only code in the Main method is
Application.Run(new MyClass());
and the application has been running pretty smoothly for a while (2-15 minutes typically) so I am pretty sure that the problem is not directly in the Main method (nor in the constructor of MyClass).
I have tried putting try-catch'es every possible place in the code, but none of them is triggered.
Does anyone have any ideas of what could cause this behaviour? I enclose the error message and exception content below.
/Peter
Error message in "Microsoft Development Environment" window that pops up:
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Exception contents:
- $exception {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.ArgumentOutOfRangeException
- System.ArgumentException {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.ArgumentException
- System.SystemException {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"} System.SystemException
- System.Exception {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" } System.Exception
System.Object {System.ArgumentOutOfRangeException} System.Object
_className null string
_COMPlusExceptionCode 0xe0434f4d int
_exceptionMethod <undefined value> System.Reflection.MethodBase
_exceptionMethodString null string
_helpURL null string
_HResult 0x80131502 int
_innerException { } System.Exception
_message "Index was out of range. Must be non-negative and less than the size of the collection." string
_remoteStackIndex 0x0 int
_remoteStackTraceString null string
_source null string
_stackTrace <undefined value> System.Object
_stackTraceString null string
_xcode 0xe0434f4d int
_xptrs 0x0 int
HelpLink null string
HResult 0x80131502 int
InnerException { } System.Exception
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
Source null string
StackTrace null string
TargetSite <undefined value> System.Reflection.MethodBase
m_paramName "index" string
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
ParamName "index" string
_rangeMessage null string
ActualValue <undefined value> System.Object
m_actualValue <undefined value> System.Object
Message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" string
RangeMessage "Specified argument was out of the range of valid values." string