[CSHARP-744] ArgumentOutOfRangeException on thread Created: 20/May/13  Updated: 20/Mar/14  Resolved: 21/May/13

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

Type: Bug Priority: Major - P3
Reporter: Chris Robison Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 x64



 Description   

Here is what my Profile class looks like:

public class Profile
{
[BsonId]
public int SequenceNumber

{ get; set; }

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?



 Comments   
Comment by Chris Robison [ 21/May/13 ]

I have found the root cause and it is not the driver. The open source MongoDB job store I'm using is apparently mapping things in such a way that interferes with the objects I'm using. Looks like I'll have to roll my own job store.

Comment by Craig Wilson [ 20/May/13 ]

I don't have a lot of experience with Quartz.NET, but I have had some. If you could put together a sample program demonstrating the issue, we'll be able to get to an answer quicker. As I don't know what you are doing exactly, this would be very difficult to troubleshoot.

It's possible quartz spins up other app domains and/or does some serialization of data between these in order to keep its jobs separate. But I won't be able to troubleshoot without your help.

Comment by Chris Robison [ 20/May/13 ]

This stuff worked fine before I started using Quartz.

Comment by Chris Robison [ 20/May/13 ]

I'm using it in connection with Quartz.NET. Upon further investigation, there are a lot more issues than this and I'm not completely sure if they are related at all to the driver. For instance, when I get an IQueryable reference from a collection and foreach through everything, only the object Id's are deserialized. Everything else is null.

Comment by Craig Wilson [ 20/May/13 ]

Hi Chris,
Sorry about your trouble. Could you explain "from a different thread"? Perhaps some code differentiating the two would be helpful.

Craig

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