[Mono-bugs] [Bug 705200] New: Linq expression transformation: Union of IQueryables

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 12 11:44:11 EDT 2011


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

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


           Summary: Linq expression transformation: Union of IQueryables
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: yallie at yandex.ru
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=439446)
 --> (http://bugzilla.novell.com/attachment.cgi?id=439446)
Test case to reproduce Linq expression transformation bug

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30
(KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30

var itFails = (
  from e in Company.Companies.AsQueryable()
  select e.Name)
Union(
  from e in Company.Companies.AsQueryable()
  select e.Name
);

Console.WriteLine("Result: {0}", String.Join(", ", itFails.ToArray()));

The query above fails with ArgumentException.
Not quite sure, but the bug looks similar to bug #701187.

Test case is attached.
Compilation: mcs LinqBug.cs (or csc LinqBug.cs)
When run on Microsoft.NET runtime, the program produces expected results.

Reproducible: Always

Steps to Reproduce:
1. Compile the attached file with either mcs or csc
2. Run mono LinqBug.exe
Actual Results:  
Produced output (when compiled by mcs):
Result: Novell, Microsoft, Google, Oracle, Sun

Unhandled Exception: System.ArgumentException: arguments
  at System.Linq.Expressions.Expression.CheckMethodArguments
(System.Reflection.MethodBase method, IEnumerable`1 args) [0x00000] in
<filename unknown>:0
  at System.Linq.Expressions.Expression.Call
(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo
method, IEnumerable`1 arguments) [0x00000] in <filename unknown>:0
  at System.Linq.Expressions.Expression.Call
(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo
method, System.Linq.Expressions.Expression[] arguments) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableTransformer.ReplaceQueryableMethod
(System.Linq.Expressions.MethodCallExpression old) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableTransformer.VisitMethodCall
(System.Linq.Expressions.MethodCallExpression methodCall) [0x00000] in
<filename unknown>:0
  at System.Linq.Expressions.ExpressionTransformer.Visit
(System.Linq.Expressions.Expression exp) [0x00000] in <filename unknown>:0
  at System.Linq.Expressions.ExpressionTransformer.Transform
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].TransformQueryable
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].Execute[IEnumerable`1]
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].GetEnumerator ()
[0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.String].AddEnumerable
(IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.String]..ctor (IEnumerable`1
collection) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.ToArray[String] (IEnumerable`1 source) [0x00000] in
<filename unknown>:0
  at Test.Program.Main () [0x00000] in <filename unknown>:0

--------------------------------------------------------
Produced output (when compiled by csc):
Result: Novell, Microsoft, Google, Oracle, Sun

Unhandled Exception: System.ArgumentException: Expression of type
'System.Object' cannot be used for parameter of type
'System.Collections.Generic.IEnumerable`1[System.String]' of method
'IEnumerable`1 Union[String](IEnumerable`1, IEnumerable`1)'
  at System.Linq.Expressions.Expression.ValidateOneArgument
(System.Reflection.MethodBase method, ExpressionType nodeKind,
System.Linq.Expressions.Expression arg, System.Reflection.ParameterInfo pi)
[0x00000] in <filename unknown>:0
  at System.Linq.Expressions.Expression.ValidateArgumentTypes
(System.Reflection.MethodBase method, ExpressionType nodeKind,
System.Collections.ObjectModel.ReadOnlyCollection`1& arguments) [0x00000] in
<filename unknown>:0
  at System.Linq.Expressions.Expression.Call
(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo
method, IEnumerable`1 arguments) [0x00000] in <filename unknown>:0
  at System.Linq.Expressions.Expression.Call
(System.Linq.Expressions.Expression instance, System.Reflection.MethodInfo
method, System.Linq.Expressions.Expression[] arguments) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableTransformer.ReplaceQueryableMethod
(System.Linq.Expressions.MethodCallExpression old) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableTransformer.VisitMethodCall
(System.Linq.Expressions.MethodCallExpression methodCall) [0x00000] in
<filename unknown>:0
  at System.Linq.Expressions.ExpressionTransformer.Visit
(System.Linq.Expressions.Expression exp) [0x00000] in <filename unknown>:0
  at System.Linq.Expressions.ExpressionTransformer.Transform
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].TransformQueryable
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].Execute[IEnumerable`1]
(System.Linq.Expressions.Expression expression) [0x00000] in <filename
unknown>:0
  at System.Linq.QueryableEnumerable`1[System.String].GetEnumerator ()
[0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.String].AddEnumerable
(IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.String]..ctor (IEnumerable`1
collection) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.ToArray[String] (IEnumerable`1 source) [0x00000] in
<filename unknown>:0
  at Test.Program.Main () [0x00000] in <filename unknown>:0


Expected Results:  
Expected output: 
Result: Novell, Microsoft, Google, Oracle, Sun
Result: Novell, Microsoft, Google, Oracle, Sun

-- 
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