Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1157

Queries fail if DefaultSerializer.ContractResolver is null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.3.5
    • Component/s: library
    • Labels:
      None

      Description

      Assuming this code:

      var config = new ClientConfiguration();
      var jsonSettings = new JsonSerializerSettings
      {
             Binder = SerializationBinder,
             TypeNameHandling = TypeNameHandling.All,
      };
      config.Serializer = () => new DefaultSerializer(jsonSettings, jsonSettings);
      var cluster = new Cluster(config);
      var bucket = cluster.OpenBucket("MyBucket");
      var context = new BucketContext(bucket);
      Queries will fail at this line:
       
              //ExtendedTypeSerializerMemberNameResolver.cs
       
              public bool TryResolveMemberName(MemberInfo member, out string memberName)
              {
                  memberName = null;
       
                  if (member == null)
                      return false;
       
                  memberName = _serializer.GetMemberName(member);  //BOOM, here
       
                  return memberName != null;
              }
      

      By setting a ContractResolver = new CamelCasePropertyNamesContractResolver() on the json settings, this problem is resolved.

      The BucketContext should probably throw if the client configuration does not provide the above.

        Attachments

          Issue Links

          For Gerrit Dashboard: NCBC-1157
          # Subject Branch Project Status CR V

            Activity

            Show
            jmorris Jeff Morris added a comment - https://github.com/couchbaselabs/Linq2Couchbase/issues/150

              People

              • Assignee:
                jmorris Jeff Morris
                Reporter:
                jmorris Jeff Morris
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.