Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
2.7.15
-
None
-
Windows10 Home developer machine
-
1
Description
When checking the list size with Bucket.ListSize(key) I am getting an error of “Unable to cast object of type ‘System.String’ to type ‘System.Collections.Generic.List`1[System.Object]’” when attempting to get the size of a list using Bucket.ListSize(key) . This happens when there is already an item in the list, which I can check for in the web portal.
public override bool ListAppend(string key, object value) |
{
|
if (string.IsNullOrWhiteSpace(key)) |
throw new ArgumentNullException(nameof(key), @"The key parameter must be string value with length greater than zero."); if (value == null) |
throw new ArgumentNullException(nameof(value), @"The value object parameter must not be null."); try |
{
|
IResult result; if (Bucket.ListSize(key).Value == 0) |
{
|
result = Bucket.Upsert(key, "[]"); |
if (!result.Success) throw result.Exception; |
} result = Bucket.ListAppend(key, value, false); if (result.Success) return true; |
throw result.Exception; |
}
|
catch (Exception ex) |
{
|
//Logger.Error("[CouchbaseCacheProvider] Error while calling ListAdd", ex); |
return false; |
}
|
}
|