List<T> issue on framework 2.0

  • Thread starter Thread starter ThunderMusic
  • Start date Start date
T

ThunderMusic

Hi,
For an unknown reason, I get an exception for getting the item at index 17
when the List<T> contains 23 items. It does not happen every time. Actually,
my app can run without a problem for 2-3 weeks, then BOOM!! I get the
exception out of nowhere... and the strangest thing is that the index is
not out of range, it's 17/23... and When I debug it, I can get the object
fine, it's not null and no exception while sending the "myList[index]" to
the Watch window. So, is there a bug in the List<T> class? I just can't see
how the bug can be on my side, the index is within the range....

thanks

ThunderMusic
 
For an unknown reason, I get an exception

Which exception? Can you post some code that will reproduce the
problem (even if we have to wait 2-3 weeks for it to occur)? is the
index a constant 17 or computed somehow?


Mattias
 
IndexOutOfRangeException

computed value... this time it happen to be 17, but it could be anything
else...

I can't post code because I would have to post all the app code...
actually, all I do is compute the value and get the element in my list...
once per 15 minutes... it's not a big load...

Anyway, I can put a try catch around it and manage it so I can try again,
but I really think it's a framework bug...

thanks

ThunderMusic
 
Sounds like it may also be a race. Are you using multiple threads to access
list or r/w to computed index?

--
William Stacey [C# MVP]

| IndexOutOfRangeException
|
| computed value... this time it happen to be 17, but it could be anything
| else...
|
| I can't post code because I would have to post all the app code...
| actually, all I do is compute the value and get the element in my list...
| once per 15 minutes... it's not a big load...
|
| Anyway, I can put a try catch around it and manage it so I can try again,
| but I really think it's a framework bug...
|
| thanks
|
| ThunderMusic
|
| | > >For an unknown reason, I get an exception
| >
| > Which exception? Can you post some code that will reproduce the
| > problem (even if we have to wait 2-3 weeks for it to occur)? is the
| > index a constant 17 or computed somehow?
| >
| >
| > Mattias
| >
| > --
| > Mattias Sjögren [C# MVP] mattias @ mvps.org
| > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
| > Please reply only to the newsgroup.
|
|
 
absolutely not... the app is "single threaded" (as much as a .net app can
be)... but it could have been it...

thanks... I'll continue looking for a possible cause...

ThunderMusic
 
Back
Top