Bug report: code contract assumptions for IQuery<T>
-
Monday, November 19, 2012 10:20 PM
public IQueryable<T> GetSortedQueryable<T>(IQuery<T> query) where T : class, IPersistentEntity { var result = this.GetNonSortedQueryable(query); // Due to a bug in the contract system Contract.Assume(query.SortingOrders != null); if (query.SortingOrders.Any()) { // Loop through each and apply in turn. result = query.SortingOrders.Aggregate(result, (current, order) => order.ApplySort(current)); } return result; }I have code contract within IQuery<T> to ensure that sorting orders are not null. Still an error is received saying there are unproven code contracts. The above code contract assumption is needed due to this bug. the following error is given when the above assumption is not included: CodeContracts: requires unproven: source != null
All Replies
-
Tuesday, November 20, 2012 1:53 AM
Hi,
It would be helpful if you could repro the warning in a short but complete program. At the very least, post the code for IQuery<T> so that we can see your contracts.
- Dave
-
Tuesday, November 20, 2012 11:17 AMDoes it help to require(query != null)?

