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

System.IndexOutOfRange Exception in Check

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.9
    • Affects Version/s: 1.8.3
    • Component/s: None
    • Environment:
      .NET Framework 4.5.1, ASP.NET MVC 5, Windows 8.1
    • Minor Change

      When passing an empty dictionary key of type string, the serializer breaks inside the CheckElementName method (BsonWriter.cs)

      The bug is thrown because the code tries to access the zero index of string-char array. As the string is empty, there is no indexes for the char array.

      I suggest a verification of the element name to test if it is empty, and if it is, throw the BsonSerializationException with a proper message.

      I can contribute to this bug resolution in GitHub if I will be authorized.

      Thank you all.

      (See attachments for a better analysis)

        1. bug.png
          bug.png
          57 kB
        2. test case.png
          test case.png
          10 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            ggondim Gustavo Gondim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: