Index out of range bug (1)

Source: Internet
Author: User

Error message:

customermessage:999999- System exception. exceptionid:ab4fde6a-d4a6-4ba0-8148-26e494ee8be3data:ttrackid>>  Better.Infrastructures.Log.TrackIDBetter.Infrastructures.Log.AppException: Split analysis anomaly--->  System.ArgumentOutOfRangeException: Index out of range. Must be non-negative and less than the collection size. Parameter name: Index   in System.ThrowHelper.ThrowArgumentOutOfRangeException ()   in System.Collections.Generic.List ' 1 . RemoveAt (Int32 index)   in System.Collections.Generic.List ' 1. Remove (T Item) in Better517Na.InterB2CFirstAnalyzePro.AnalysisProcess.MainProcess.TaskProcess (Object objtask) Location MainProcess.cs: Line number 118---the end of the inner exception stack trace---     

Following the code discovery is the phrase: Dealingtasklist is List<string>,taskid is a string.

Dealingtasklist.remove (TaskID);

There's no problem with it, but the result is a problem, so I'll change to the following

if null && dealingtasklist.exists (sa = sa = = TaskID)) {    dealingtasklist.remove (TaskID);}

The result or error, there is no way, had to remember the log to see if it appears in this place. But halfway I think of them as if it is a thread to do, will not be multi-threaded when there is a problem? So I changed the code to look like this. To prevent the case, I will keep a diary.

 lock   (Lockobj) { if  (dealingtasklist! = null  && dealingtasklist.exists (sa = SA == TaskID) {temp  + =  " [ex Enter]    + =  [ex removal succeeded"   " ;  else   {temp  + =  [ex does not meet the criteria"   " ; }}

So far, no such bug has occurred.

Index out of range bug (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.