[CSHARP-953] Limited number of parameters in BSonConstructor with .NET 3.5 Created: 16/Apr/14 Updated: 16/Apr/14 Resolved: 16/Apr/14 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 1.9 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Guillaume Androz [X] | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | Windows, bson, driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7, VS2010, MongoDB 2.6, .NET 3.5 project |
||
| Description |
|
This issue has been posted on StackOverflow : http://stackoverflow.com/questions/23093702/mongodb-c-sharp-with-driver-1-9-serialization-limited-number-of-parameters/23110359#23110359 The problem is that with .NET 3.5, I am not able to use custom BsonConstructor with more than 4 parameters, whereas if I use .NET 4.0 the issue is not here. I search a long time a workaround for this issue, and I dont have any idea of what causes this. |
| Comments |
| Comment by Guillaume Androz [X] [ 16/Apr/14 ] |
|
Hi Craig. |
| Comment by Craig Wilson [ 16/Apr/14 ] |
|
In .NET 3.5, there are only 4 definitions of Func. with the maximally defined version having 4 parameters. .NET 4.0 extends that number to 8, and .NET 4.5 extends that to 16. I guess we could define extra Funcs, but then people using .NET 4 with the driver would get conflicting types. We could also define our own MongoFunc classes which go up to a high number of parameters, however .NET 4 has already solved this problem and our next driver version will require .NET 4. I'd suggest that you upgrade to .NET 4 if possible. Alternatively, it might be possible for you to define the Func delegate with the required number of parameters and the driver would find it at runtime. I haven't tested this so don't expect great results. |