Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-502

NullReferenceException on First() call

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 1.4.2
    • Component/s: None
    • Environment:
      VS 2010, MongoDB 2.0.2, Windows 7x64

      I am having issues with the latest MongoDB C# driver (v1.4.2.4500) crashing when I query this document:

      {
      "_id" : "4fdfe705b48c6b24dcab994a",
      "CreatedDate" : new Date("6/18/2012 19:42:13"),
      "UpdatedDate" : new Date("6/18/2012 19:42:13"),
      "SiteId" : "4fdfe705b48c6b24dcab9939",
      "ClientId" : "4fdfe705b48c6b24dcab9937",
      "Account" :

      { "UserName" : "blah", "Password" : null, "PasswordSalt" : null, }

      ,
      "FbAccount" :

      { "_id" : "838331911", "access_token" : ".....", "Pages" : [] }

      }

      Query:

      var q1 = from u in this.Repository.All<User>()
      where u.FbAccount.Id == "832631911"
      select u;

      var foo1 = q1.First();

      Repository:

      public IQueryable<T> All<T>() where T : class, new()
      {
      return this.GetQuery<T>().FindAll().AsQueryable();
      }

      Exception:

      [NullReferenceException: Object reference not set to an instance of an object.]
      lambda_method(Closure , User ) +137
      System.Linq.WhereEnumerableIterator`1.MoveNext() +155
      System.Linq.Enumerable.First(IEnumerable`1 source) +244
      lambda_method(Closure ) +322
      System.Linq.Queryable.First(IQueryable`1 source) +382
      AuctionCMS.Framework.Services.ClientService.GetByFacebookUserId(String fbUserId) in ClientService.cs:39

      Am I doing something wrong or is this a bug?

            Assignee:
            Unassigned Unassigned
            Reporter:
            rboarman Rick B.
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: