[CSHARP-613] LINQ queries don't work with fields/properties of type short (Int16) Created: 24/Oct/12  Updated: 02/Apr/15  Resolved: 20/Feb/14

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.6.1
Fix Version/s: 1.9

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Sridhar Nanjundeswaran
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-900 Support downcasting object in LINQ qu... Closed

 Description   

To reproduce:

public class C
{
    public int _id;
    public short s;
}
 
var query =
    from x in collection.AsQueryable<C>()
    where x.s == 2
    select x;

which results in the following exception:

Unsupported where clause: ((Int32)x.s == 2)



 Comments   
Comment by Bar Arnon [ 08/Jun/14 ]

Apparently this issue still exists in enums of these types:
https://jira.mongodb.org/browse/CSHARP-989

Comment by Githook User [ 20/Feb/14 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-613: added test proving that this is fixed.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/4c37e05f14f2d8259100f8f6d99a350eb893b2a1

Comment by Avishay Lavie [ 09/May/13 ]

Any news about this? The fix seems pretty simple and this is quite a major bug...

Comment by Kirill Davletkildeev [ 04/Feb/13 ]

Here is the pull request https://github.com/mongodb/mongo-csharp-driver/pull/148

Comment by Craig Wilson [ 04/Feb/13 ]

If you would like to take a stab, base this on master. We have migrated most of the x2.0 branch back into master in a compatible way and they will coming out in 1.8.

Comment by Kirill Davletkildeev [ 03/Feb/13 ]

This occurs with most of implicit conversions on builtin types (like in #6.1.2 in C# specification). I could make a pull request. Would it be ok for x2.0?

Comment by Robert Stam [ 24/Oct/12 ]

Good point. Thanks for the suggestion!

Comment by Ian Campbell [ 24/Oct/12 ]

Check ushort, byte, and sbyte too. I believe this occurs on all integers of under 32 bits in size.

Generated at Wed Feb 07 21:37:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.