mgusmano / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

.ToArray() and .ToList() methods on IEnumerable<T> results in "Object doesn't support property or method 'GetEnumerator'" #220

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

        private void ToArrayBug()
        {
            var sample = new jQuery("<ul><li>1</li><li>2</li><li>3</li><li>4</li>");

            var sampleEnumerable = from s in sample.children() select s;
            var sampleArray1 = sampleEnumerable.ToArray();

            var sampleList = new List<HtmlElement>();
            foreach(var s in sample.children())
                sampleList.Add(s);
            var sampleArray2 = sampleList.ToArray();
        }

What is the expected output? What do you see instead?
In the code sample, one should be able to use the Linq methods ToArray() or 
ToList() on sampleEnumerable; however this results an exception in jsclr-4.1.0 
at line 4211.
In the same example, a list created by iterating over the enumeration can be 
converted to an array with ToArray().

What version of the product are you using? On what operating system?

The example method is in a class with JsMode.Clr. The version is 4.29.9000 and 
the clr is 4.1.0.

Original issue reported on code.google.com by tworedce...@gmail.com on 23 Sep 2012 at 8:07

GoogleCodeExporter commented 8 years ago

Original comment by yvan.rod...@gmail.com on 4 Oct 2012 at 5:22

GoogleCodeExporter commented 8 years ago
This is because jQuery doesn't export a GetEnumerator method.

Original comment by yvan.rod...@gmail.com on 12 Dec 2012 at 7:06

GoogleCodeExporter commented 8 years ago
Duplicate of 258.

Original comment by yvan.rod...@gmail.com on 13 Jan 2013 at 1:51