score:3
Accepted answer
There seems to be a bug here.
Your query desugars to:
IQueryable<IStudentTermData> query =
studentTermDataSet.Join(studentSet,
studentTermData => studentTermData.StudentId,
student => student.Id,
(studentTermData, student) => new {studentTermData, student})
.Where(s => (s.student.Active))
.Select(std => std.studentTermData);
The only parameter called "constructor" is the last parameter of the Join
method, and indeed, if you change the code to:
var query =
studentTermDataSet.Join(studentSet,
studentTermData => studentTermData.StudentId,
student => student.Id,
Tuple.Create);
then it compiles without warnings.
The difference is that the first query uses the Join
overload which takes an Expression
as a parameter, whereas the second one takes a Func
(and returns an IEnumerable
).
So I think that the support for expression trees is possibly not complete yet. You could post a question on the Code Contracts forum to ask about this.
Source: stackoverflow.com
Related Query
- Diagnosing 'CodeContracts requires unproven: constructor != null'?
- ERROR Static method requires null instance, non-static method requires non-null instance
- LINQ Source Code Available
- .NET 4 Code Contracts: "requires unproven: source != null"
- EF Code First comparing null values generates strange query
- SQL Trigger is trying to insert a null value but my C# code is passing int 300?
- creating Linq to sqlite dbml from DbLinq source code
- LINQ to XML set value if it is not null otherwise use default value from the constructor
- linq null refactoring code
- Null reference exception in my LINQ to XML code
- ASP.net Getting Max Date of database Date column How to avoid Null in Date Column C# My code Attached
- How to handle nulls in this LINQ Code using a possible null List?
- source code for LINQ 101 samples
- Linq query null check in data source
- WPF - Linq moved to constructor is causing null reference exception, how come?
- Code First Entity Framework, select ViewModel - constructor with parameter
- Include null cells in Linq query from DB in C# code
- expr. tree: Static method requires null instance, non-static method requires non-null instance
- List or Array of String Contain specific word in Html Source Code
- c# Linq or code to extract groups from a single list of source data
- Generated DBML code incorrectly marks returned columns as NOT NULL for stored procedures
- where Clause in Asp.net is returning null exception in the code below
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- How to check if IEnumerable is null or empty?
- FirstOrDefault: Default value other than null
- Value cannot be null. Parameter name: source
- LINQ order by null column where order is ascending and nulls should be last
- An expression tree lambda may not contain a null propagating operator
- Linq code to select one item
More Query from same tag
- LINQ: Prefetching data from a second table
- How to find where the records exists in the array or not using c#
- C# Left join in LINQ
- LINQ: Why does Expression.Call() reference the Db when CreateQuery() does as well?
- Linq Group by Week Number Including 0 Record Weeks
- Is this LINQ dynamic orderby method thread safe?
- How to write this LINQ Query in a better way
- List inside a list in linq - what is it?
- Checking existence before inserting via Linq to SQL
- C# Enumerable.Except() only returns the same element once
- How do I get active rows in 1 to many relationship using Linq?
- Help with Linq and Dictionary's ContainsKey method
- Is there any way to make this query faster?
- Returning the middle n (values not index) from a collection
- How to Pass a List of Items from View to Controller (ASP.NET MVC 4)
- data grid does not show data in C# wpf application
- Only primitive types or enumeration types are supported in this context C# Link
- How to Transform in to one function using generics or dynamic?
- How To properly perform arithmetic operations over Two List/Array
- Linq query stored as string and/or serialized as Json
- IEqualityComparer for SequenceEqual
- sqlLinq Take higher RN number
- Why is my update not persisting?
- LINQ to return subset of data grouped into an anonymous type
- Using a where condition within an inner element in XML
- Convert SQL query to linq/lambda expression with sum and group by condition
- Left outer join in Linq
- Entity Framework: best practice to filter data inside multiple "one-to-many" relationships
- Why do I get a Unable to cast object of type 'WhereSelectEnumerableIterator for the following code?
- linq group messages show only last ones as whats app do