[Mono-bugs] [Bug 679174] New: ConcurrentBag<T>.GetEnumerator() yields uninitialized elements

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Mar 13 07:33:34 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=679174

https://bugzilla.novell.com/show_bug.cgi?id=679174#c0


           Summary: ConcurrentBag<T>.GetEnumerator() yields uninitialized
                    elements
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gandro at gmx.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=418997)
 --> (http://bugzilla.novell.com/attachment.cgi?id=418997)
MonoDevelop project file with example

Description of Problem:
Enumerating a ConcurrentBag<T> yields uninitialized elements which have not
been added to the collection.

Steps to reproduce the problem:
1. Create an instance of ConcurrentBag<T> and add some elements.
2. Enumerate the instance.

For example:
var concurrentBag = new ConcurrentBag<string>();
// add elements
int elementCounter = 0, nullCounter = 0;
foreach(string element in concurrentBag) {
    if(element == null) {
        nullCounter++;
    }
    elementCounter++;
}

Actual Results:
  concurrentBag.Count: 1000
  Total enumerated elements: 2048
  Uninitialized elements: 1048

Expected Results:
  concurrentBag.Count: 1000
  Total enumerated elements: 1000
  Uninitialized elements: 0

Additional Information:
Sample MonoDevelop project file attached.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list