Missing elements of collection

Posted by Neir0 on Stack Overflow See other posts from Stack Overflow or by Neir0
Published on 2010-04-10T07:48:23Z Indexed on 2010/04/10 7:53 UTC
Read the original article Hit count: 374

Filed under:
|

I have a collection

ObservableCollection<string> outoverList

And i have a function which call collection

outoverList.Add("out:"+element.tagName);

Function call collection a few times, but sometimes collection lost elements. We call a function -> function adds element -> collection has 9 elements(for example) -> in the next function calling collection has only 8 elements. One elements be missing.

Here Resharpers Find usages log:

   Search target
  FindElementHandler.outoverList:ObservableCollection<string>
Found 3 usages in solution
  <FindElementExperiments> (3 items)
    FindElementHandler.cs (3 items)
      (50,13) outoverList = new ObservableCollection<string>();
      (94,13) outoverList.Add("out:"+element.tagName);
      (118,13) outoverList.Add("over:" + element.tagName);

As you can see i just add elements to collection everywhere. i havent remove elements code.

Maybe i did something wrong you can look at screen capture: http://www.youtube.com/watch?v=Ei6dQnHCMIc

I am newbie and often encounter with various problems but this bug looks mystic for me.

P/S/ Sorry for english

© Stack Overflow or respective owner

Related posts about c#

Related posts about observablecollection