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

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.2
    • 2.3.5
    • library
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

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

            People

              jmorris Jeff Morris
              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