*) Build environment:
VS 2010, Target platform: .NET 3.5, driver versions: 1.1 both official and the latest sources
*) Steps to reproduce:
Add the following method to the MongoDB.BsonUnitTests.BsonArrayTests:
void TestCompilerError()
{
var values = new BsonValue[] { };
// all 3 calls cannot compile
BsonArray.Create(values);
var array = new BsonArray(values);
array.AddRange(values);
}
.. and compile. Compilation fails with an error (3 similar errors):
The call is ambiguous between the following methods or properties: 'MongoDB.Bson.BsonArray.Create(System.Collections.Generic.IEnumerable<MongoDB.Bson.BsonValue>)' and 'MongoDB.Bson.BsonArray.Create(System.Collections.Generic.IEnumerable<object>)'
*) Possible solution:
Remove 3 methods dealing with System.Collections.Generic.IEnumerable<object> from MongoDB.Bson.BsonArray (constructor, Create, AddRange). As it was mentioned in https://jira.mongodb.org/browse/CSHARP-276, these methods are redundant after adding methods dealing with non-generic IEnumerable. Now they seem to be also troublesome.
I tried to remove these 3 methods from the latest sources. The test code is compiled successfully.