-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PatchOperation.Set cannot handle null values #2931
Comments
Hi, I have a workaround as below which could resolve your problem:
My thought is that here we shouldn't add null checks for value. |
This works for me. Instead of using null I just create a JProperty with the value null. And use that value.
|
Edit: Thanks @rvdvelden, that works perfectly! |
BTW, a much easier way to get a null JToken: JValue.CreateNull() |
@deparash what's the expected server contract for such scenarios? |
Update: (offline closure with @deparash ) Value is expected and it should be JSON NULL. |
@SchintaMicrosoft assigned it to you. |
This should still be open, not closed. There are hacky workarounds for now, commented above |
Github automatically closes the issue when the PR is merged. A new version should be released hopefully by tomorrow with the fix. |
Not fixed in 3.26.2 |
@onionhammer please try the latest SDK release 3.27.0 https://github.com/Azure/azure-cosmos-dotnet-v3/releases/tag/3.27.0 |
Yep, thanks, that fixes it |
Using Microsoft.Azure.Cosmos 3.28 and i dont see any fix? will have to resort to the above said workaround from rvdvelden |
Describe the bug
PatchOperation.Set throws ArgumentNullException when value is null.
To Reproduce
await container.PatchItemAsync(id, PartitionKey.None, new List { PatchOperation.Set("/name", null) });
Expected behavior
Value should be set to null.
Actual behavior
Environment summary
SDK Version: 3.23.0
OS Version (e.g. Windows, Linux, MacOSX) Windows 11
Additional context
According to @sajeetharan (https://stackoverflow.com/a/70194090/22092), this seems to be a known issue but I couldn't find any matching issue in github.
The text was updated successfully, but these errors were encountered: