Note that there are some explanatory texts on larger screens.

plurals
  1. POExpression failure
    text
    copied!<p>I've got such expression:</p> <pre><code>Linq2Rest.Reactive.InnerRestObservable`1[A] .Where(item =&gt; (Convert(IIF((item != null), item.ID, 0)) == Convert(61))) .Skip(0) .Take(20) </code></pre> <p>When I invoke <a href="http://msdn.microsoft.com/en-us/library/ff402849%28v=vs.103%29.aspx" rel="nofollow">Subscribe method</a> on it I recieve such error:</p> <blockquote> <p>variable 'item' of type 'A' referenced from scope '', but it is not defined</p> </blockquote> <p>Can't figure out what is the problem. Actually can't see any problems with item argument... </p> <p>UPD. Where clause built with this code:</p> <pre><code>public static IQbservable WhereExpression(this IQbservable query, Expression filterExpression, ParameterExpression instance = null) { if (instance == null) instance = Expression.Parameter(query.ElementType, "item"); // NOI18N var filteredQuery = (IQbservable)GenericsHelper.InvokeGenericExtensionMethod( typeof(Qbservable), "Where", // NOI18N new[] { query.ElementType }, query, Expression.Lambda(filterExpression, instance) ); return filteredQuery; } public static object InvokeGenericExtensionMethod( Type extensionClass, string extensionMethodName, Type[] genericTypes, params object[] parameters ) { var method = extensionClass.GetMethods().FirstOrDefault(m =&gt; m.Name == extensionMethodName &amp;&amp; m.IsGenericMethod &amp;&amp; m.GetGenericArguments().Length == genericTypes.Length &amp;&amp; m.GetParameters().Length == parameters.Length ); if (method == null) throw new ArgumentException(string.Format("Type {0} doesn't contain method {1}", extensionClass.Name, extensionMethodName)); // NOI18N var genericMethod = method.MakeGenericMethod(genericTypes); return genericMethod.Invoke(null, parameters); } </code></pre> <p>UPD 2. This is how WhereExpression calls:</p> <pre><code>foreach (var filter in filters) { var paramExpression = Expression.Parameter(query.ElementType, "item"); // NOI18N query = query.WhereExpression(filter.CreateFilterExpression(paramExpression), paramExpression); } </code></pre> <p>filters is collection of IFilterDescriptor interface from telerik. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload