GetAllBucketsAsync always throws ArgumentNullException
Description
Environment
Windows, .NET Core
Gerrit Reviews
None
Release Notes Description
None
relates to
Activity
Show:

Jeffry Morris April 11, 2021 at 6:54 PM
It should throw `ServiceNotAvailableException` at the least.

Richard Ponton April 11, 2021 at 6:52 PM
In Jenkins tests for Transactions, I'm also seeing this issue, though the stack trace has morphed a bit over time.
BucketManager.GetAllBucketsAsync() leads to BucketManager.GetUri() => _serviceUriProvider.GetRandomManagementUri() which may return null.
Somewhere along the line, this method should check that there are actually nodes and either WaitUntilReadyAsync() internally or throw a more appropriate exception.
Fixed
Pinned fields
Click on the next to a field label to start pinning.
Created June 12, 2020 at 3:23 PM
Updated May 13, 2021 at 6:40 PM
Resolved May 6, 2021 at 8:04 PM
Instabug
Summary: GetAllBucketsAsync always throws a "Value cannot be null" exception.
Repro: See code sample:
using System;
using System.Threading.Tasks;
using Couchbase;
namespace DeleteMe
{
class Program
{
static async Task Main(string[] args)
{
var cluster = await Cluster.ConnectAsync("couchbase://localhost", "Administrator", "password");
var buckets = await cluster.Buckets.GetAllBucketsAsync();
foreach (var bucket in buckets)
{
Console.WriteLine(bucket.Key + " " + bucket.Value);
}
await cluster.DisposeAsync();
}
}
}
Expected: I have 3 buckets running in the cluster, it should return information about them.
Actual: Exception. See stack trace:
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName)
at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value)
at Newtonsoft.Json.Linq.Extensions.Value[U](IEnumerable`1 value)
at Couchbase.Management.Buckets.BucketManager.GetBucketSettings(JToken json)
at Couchbase.Management.Buckets.BucketManager.GetAllBucketsAsync(GetAllBucketsOptions options)
at DeleteMe.Program.Main(String[] args) in C:\zproj\DeleteMe\DeleteMe\Program.cs:line 13
at DeleteMe.Program.<Main>(String[] args)
C:\zproj\DeleteMe\DeleteMe\bin\Debug\netcoreapp3.1\DeleteMe.exe (process 31576) exited with code -532462766.
Press any key to close this window . . .