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

Exception iterating over a DataStructures dictionary

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.2.6
    • 3.2.5
    • library
    • None
    • 1

    Description

      Exception - Newtonsoft.Json.JsonSerializationException, Could not create an instance of type System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,TestCouchbaseCollection.Foo]]. Type is an interface or abstract class and cannot be instantiated. Path 'Fred', line 1, position 8.
      

      using (var cluster = await Cluster.ConnectAsync("couchbase://dev-docker01", "Administrator", "password"))
      {
      	var bucket = await cluster.BucketAsync("sms-data").ConfigureAwait(false);
      	var collection = await bucket.DefaultCollectionAsync().ConfigureAwait(false);
      	var dict = collection.Dictionary<Foo>("testdatadict");
      	await dict.ClearAsync().ConfigureAwait(false);
      	await dict.AddAsync("Fred", new Foo { Name = "Tom", Age = 50 });
      	await dict.AddAsync("Bill", new Foo { Name = "Dick", Age = 30 });
       
      	foreach (var item in dict)
      	{
      		Console.WriteLine($"{item.Key} - {item.Value.Name}, {item.Value.Age}");
      	}
      }
      

      https://forums.couchbase.com/t/troubles-with-persistentdictionary/32387/5

      Attachments

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

        Activity

          People

            jmorris Jeff Morris
            btburnett3 Brant Burnett
            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