Home

Old LinqPad version (2.42.01) throws "Lambda Parameter not in scope" and problems in new version.

Hi.

I have folloing C# code:
void Main()
{
 var strings = new[] { "d", "test", "m", "s"};
 
 Expression<Func<HighWays, bool>> predicate = o => false;

 foreach (string s in strings)
 {
   string s1 = s;
   Expression<Func<HighWays, bool>> filter = o => o.Name.Contains(s1);
 predicate = Expression.Lambda<Func<HighWays, bool>>(Expression.Or(predicate.Body,         filter.Body),predicate.Parameters);
}
var query = HighWays.Where(predicate).Count();
		
}


Version 2.42.01 throws InvalidOPeratiopnException "Lambda Parameter not in scope".

Version 4.44.09 (beta) throws "variable 'o' of type 'LINQPad.User.HighWays' referenced from scope '', but it is not defined".

HighWays is a simple table with two columns -- id and some string name.

Meanwhile on .net 4.0 it works great.

What I'm doing wrong in LinqPad?

Thanks in advance.
Sign In or Register to comment.