I have been using the Couchbase .NET Client 22.214.171.124 for at while, and the behavior that gave me with the
GetJson method was, that if the key did not exist, it returned
default(T). But after upgrading to 126.96.36.199 I now get a
NullReferenceException, if the key does not exist.
On top of that, I cannot store a simple string value with
StoreJson and fetch it afterwards using
GetJson, as I here get some kind of JSON parsing error.
Can anyone shed light on, what has happened to the previous (and in my opinion, correct) behavior of the JSON extensions?
There were some changes to dependencies in trying to simplify the client, but to my knowledge there is nothing that should have broken API. Do you have a simple test case by chance that shows the problem without your actual data?
It should be easy to reproduce with an empty Couchbase bucket and a simple call to
GetJson. Version 188.8.131.52, which we are using, returns
default(T), however the new 184.108.40.206 (from NuGet) throws an exception.
Are you able to reproduce this behavior?
I haven’t tried to reproduce the error and you haven’t provided a stack trace, but looking at the source for
GetJson it looks a bit funky.
Line 105: https://github.com/couchbase/couchbase-net-client/blob/master/src/Couchbase/Extensions/CouchbaseClientExtensions.cs#L105
If this underlying call returns
null, the DocHelper will crash since it tries to access
null.Contains. But the code in line 106, kind off implies that JSON should be able to be null. A bit confusing and I don’t know (since I haven’t tried it) if it’s as simple as not invoking the DocHelper, but since it’s an extension method, you could replicate the code your self, right, and see if that solves the issue.
Anyway, I’m sure someone at Couchbase will attend this soon otherwise.