|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
List<T> issue on framework 2.0Hi,
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 theproblem (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. 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 Show quote "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message news:OJSUgJM6GHA.4592@TK2MSFTNGP04.phx.gbl... > >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. Sounds like it may also be a race. Are you using multiple threads to access
list or r/w to computed index? -- Show quoteWilliam Stacey [C# MVP] "ThunderMusic" <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote in message news:%23z6kgOM6GHA.2084@TK2MSFTNGP06.phx.gbl... | 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 | | "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message | news:OJSUgJM6GHA.4592@TK2MSFTNGP04.phx.gbl... | > >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 Show quote "William Stacey [C# MVP]" <william.sta***@gmail.com> wrote in message news:%23endb6M6GHA.4404@TK2MSFTNGP04.phx.gbl... > 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] > > "ThunderMusic" <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote in message > news:%23z6kgOM6GHA.2084@TK2MSFTNGP06.phx.gbl... > | 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 > | > | "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message > | news:OJSUgJM6GHA.4592@TK2MSFTNGP04.phx.gbl... > | > >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. > | > | > > |
|||||||||||||||||||||||