[CSHARP-1443] Count() throws InvalidOperationException Created: 15/Oct/15 Updated: 20/Jan/16 Resolved: 16/Oct/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.1 |
| Fix Version/s: | 2.1 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Ilya | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Window 8 64 bit |
||
| Attachments: |
|
| Description |
|
The attached code throws an InvalidOperationException() Sequence contains no elements. var items = collection.AsQueryable().Where(o => o.Id.Length>100).ToList(); The items value is 0. I want see count value is 0, but have exception. |
| Comments |
| Comment by Githook User [ 16/Oct/15 ] |
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: |
| Comment by Githook User [ 16/Oct/15 ] |
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: |
| Comment by Ilya [ 15/Oct/15 ] |
|
Sorry, version is 2.1.0-rc1. Thanks for your answer. |
| Comment by Craig Wilson [ 15/Oct/15 ] |
|
I've changed the affects version to 2.1 because 2.0.1 does not include LINQ. This does look like it's a bug related to how aggregate returns a count when no documents match the filter. Thanks for reporting. Craig |
| Comment by Ilya [ 15/Oct/15 ] |
|
Hello. Added file with sample. |
| Comment by Craig Wilson [ 15/Oct/15 ] |
|
Hi ilya, We have a great number of tests that exercise this bit of code. Could you provide a sample console program that causes this to occur? Thanks, |