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

Misleading exception message

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Windows 7, latest code from github

      If you get an error like this:

      MongoDB.Bson.BsonSerializationException: Duplicate element name 'EntryId' in class 'LoopLib.Common.LogEntry'

      It might not have nothing to do with "EntryId". It's due to a duplicate BsonElement name anywhere in the
      class, not necessarily on that field.

      For example, I had something like this:

      [BsonId]
      public Guid EntryId

      { get; set; }

      [BsonElement("a")]
      public int A { get; set; }

      [BsonElement("a")]
      public int B

      { get; set; }

      For people who are renaming their fields to save storage space, this will be a common mistake.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            ericzbeard Eric Z. Beard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: