[CSHARP-708] BsonClassMap.SetIdMember fails for lhamda expressions that contain interface members Created: 20/Mar/13 Updated: 20/Mar/14 Resolved: 21/Mar/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Blake Niemyjski | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 8, MongoDB 2.4 |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
We upgrade to the 1.8 driver via NuGet this morning and instantly brought down our dev environment. Here is part of the stack trace: at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate) Here is some snippets that will show how to reproduce: protected override void ConfigureClassMap(BsonClassMap<T> cm) { .. public interface IIdentity { } .. public class JobHistory : IIdentity { } |
| Comments |
| Comment by Blake Niemyjski [ 21/Mar/13 ] | |||||
|
You guys are awesome! | |||||
| Comment by auto [ 20/Mar/13 ] | |||||
|
Author: {u'date': u'2013-03-20T16:28:11Z', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: | |||||
| Comment by auto [ 20/Mar/13 ] | |||||
|
Author: {u'date': u'2013-03-20T16:01:49Z', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: | |||||
| Comment by Blake Niemyjski [ 20/Mar/13 ] | |||||
|
Hello, Thanks for the clarification. I think we may have one other potentially blocking issue. I'll let you know when I get into the next sprint (later today/this week). | |||||
| Comment by Craig Wilson [ 20/Mar/13 ] | |||||
|
Just to note... This problem only exists for lambdas applied to a class with a constraint where the implementation contains a different number of accessors than the interface. That was a mouthful, so as to your example... Because IIdentity.Id only has a getter, but your implementation JobHistory.Id has a getter and a setter, we are having an issue. Hence, if this is the only location that type of thing occurs, you are probably ok (and we'd like to know if you hit any other regressions; this was a major release). In previous versions of the driver, this worked by accident, so we were a little surprised it worked at all when the report came in. | |||||
| Comment by Blake Niemyjski [ 20/Mar/13 ] | |||||
|
Thanks for the work around, I may wait this one out for a 1.8.1 as we have a ton of code uses lhamdas for setting representation and member names. | |||||
| Comment by Craig Wilson [ 20/Mar/13 ] | |||||
|
Ok, crappy workaround, but I think very safe in this case is to use a string instead of the lambda expression. It's unlikely you'll change the Id member name in your IIdentity interface.
Let me know if this is satisfactory in the mean time and we'll get this fixed for the next release. | |||||
| Comment by Craig Wilson [ 20/Mar/13 ] | |||||
|
I can confirm this is a regression. I'll work to figure out a simple workaround and post back. |