-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 1.8.1
-
Component/s: None
-
None
-
Environment:Windows 7 x64
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Here is what my Profile class looks like:
public class Profile
{
[BsonId]
public int SequenceNumber
public string Code { get; set; }
public string Name
{ get; set; }}
I'm getting the following exception when I try and call EnsureIndex from a different thread referencing the above class:
System.ArgumentOutOfRangeException Class Profile does not have a member called Code.
Parameter name: memberName MongoDB.Bson.Serialization.BsonSerializationInfo GetMemberSerializationInfo(System.String) at MongoDB.Bson.Serialization.BsonClassMapSerializer.GetMemberSerializationInfo(String memberName)
at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.VisitMember(MemberExpression node)
at MongoDB.Driver.Linq.ExpressionVisitor`1.Visit(Expression node)
at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.Visit(Expression node)
at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.VisitLambda(LambdaExpression node)
at MongoDB.Driver.Linq.ExpressionVisitor`1.Visit(Expression node)
at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.Visit(Expression node)
at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.GetSerializationInfo(Expression node, Dictionary`2 serializationInfoCache)
at MongoDB.Driver.Builders.IndexKeysBuilder`1.<GetElementNames>b__0(Expression`1 x)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at MongoDB.Driver.Builders.IndexKeysBuilder`1.Ascending(Expression`1[] memberExpressions)
at XactPrm.Data.Repository.ProfileRepository..ctor(String connectionStringOverride) in e:\prm-online-robison\XactPrm.Data\Repository\ProfileRepository.cs:line 13
Line 13 is this: Collection.EnsureIndex(new IndexKeysBuilder<Profile>().Ascending(p => p.Code));
When I do this from the main thread it seems to work. Not sure what the difference is. Any suggestions?