ThrowableBucket class not available after updating CouchbaseNetClient from v2.5.0 to v2.5.10


#1

I have a working application currently using CouchbaseNetClient v2.5.0, compiling and running correclty
(Visual Studio 2017)
I’d like to update the CB client to a more recent one (v2.5.10).
I use Visual Studio 2017 Nuget Manager to select all assemblies using CouchbaseNetClient selecting v2.5.10 from the list of available nuget package versions, and install.
Once finished, I get a compilation error “The type or namespace name ‘ThrowableBucket’ could not be found (are you missing a using directive or an assembly reference?)”

The code looks like this:
using Couchbase;

namespace AgilityWorks.CloudFabriq.Identity.AspNetIdentity
{
public class ApplicationDbContext : ThrowableBucket
{
public ApplicationDbContext()
: base(ClusterHelper.GetBucket(Config.Couchbase.Bucket))
{
}
}
}

I’d expect v2.5.10 should be backward compatible.
Am I missing something?


#2

Hi @balintn

ThrowableBucket is part of the couchbase-aspnet-identity package, not part of the Couchbase .NET SDK. Did you also update the ASP.NET Identity provider too?

Occasionally you can get this type of error if old build artifacts are present in the /bin and /obj folders. I’d suggest clearing these folder manually before rebuilding.


#3

Hi Mike,
Thanks for the feedback.
Yes, I found that ThrowableBucket comes with Couchbase ASPNet Identity (here [https://blog.couchbase.com/the-couchbase-asp-net-identity-storage-provider-part-1/]), however, I can’t find any reference to it in our code.
Our app is made up of some assemblies that are built separately, I’ve already updated CouchbaseNetClient references in those, and I loaded them as Nuget packages into the main solution. One idea was, that one of them contained a reference to CouchbaseASPNetIdentity, and I somehow removed that in the update process. However, I checked the changes in source control, and there was no reference to CouchbaseASPNetIdentity at all.
I also tried to search for CouchbaseASPNetIdentity to explicitly in the Visual Studio Nuget package manager to add it to the main solution, but the search doesn’t return Couchbase ASP.Net Identity (as in the article above).
Shall I try to install it from the nuget console? What’s the package id?


#4

The Couchbase ASP.NET Identity Provider Nuget package name is CouchbaseIdentity.
Nuget package: https://www.nuget.org/packages/CouchbaseIdentity
Github repository: https://github.com/couchbaselabs/couchbase-aspnet

However, please be aware that package is very old and has not had any work done to it since July 2015. I’m not certain we have a direct replacement with a newer package. @jmorris may be able to advise on an alternative.


#5

@balintn -

There is no current alternative for the older ASP.NET Identity provider; however there are plans for an ASP.NET Core Identity in the future. Additionally, updating from Couchbase .NET SDK 2.5.0 to 2.5.10 shouldn’t cause any issues; there are no breaking interface changes that I know of - unless its related to a dependency update on one of the .NET libraries. I really doubt that, however.

Looking at your original post with source code, it seems like you are missing the using statement for the namespace that ThrowableBucket is in. This would most definitely cause this error: "The type or namespace name ‘ThrowableBucket’ could not be found (are you missing a using directive or an assembly reference?)”. I suggest adding the namespace like this:

using Couchbase;
using Couchbase.AspNet.Identity;

namespace AgilityWorks.CloudFabriq.Identity.AspNetIdentity
{
     public class ApplicationDbContext : ThrowableBucket
     {
          public ApplicationDbContext(): base(ClusterHelper.GetBucket(Config.Couchbase.Bucket))
         {
         }
     }
   ....
}