Cast error when enumerating a view


#1

I have a view whose key-value pair is (expiration, doc) where doc is always a number.

When I read the results of the view via the .NET API, I get the following error:

Newtonsoft.Json.JsonSerializationException: Error converting value 1 to type ‘Couchbase.IViewRow’. Path ‘’, line 1, position 1. —> System.ArgumentException: Could not cast or convert from System.Int64 to Couchbase.IViewRow.
at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
— End of inner exception stack trace —
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Couchbase.GenericViewRowTransformer1.TransformRow(JsonReader reader, ICouchbaseClient client, Boolean shouldLookupById) at Couchbase.CouchbaseViewHandler.<ReadResponse>d__01.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
CouchbaseMigration\CouchbaseMigrationMain.cs(67,0): at Tools.CouchbaseMigration.CouchbaseMigrationMain.Test()

This looks like a bug. Or am I doing something wrong?


#2

dorony -

Can post your code?

-Jeff