-
Notifications
You must be signed in to change notification settings - Fork 252
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
Duplicate Fields Serialized to Request Body When Set Explicitly to Null #2768
Comments
Thanks for raising this @mslogriffi Out of curiosity, do you still get duplicate fields if you use the following the methods to serialize the object? |
It doesn't look like I do on 5.65.0. Running this code:
Gives this result (with 'testOutputHelper' being a ITestOutputHelper given by XUnit):
I verified the same output is produced with version 5.56.0. |
Describe the bug
I am using the GraphServiceClient class in some unit tests. Some unit tests populate fields on Graph contract objects with ternary statements (e.g.
application.Description = condition ? "a description" : null
). In the null cases here, I am observing the GraphServiceClient serialize the nulled field twice in the request body, which is causing JSON validation errors in my tests.Expected behavior
Setting any field on the Application object explicitly to null and then using it in a GraphServiceClient request body serializes the object into valid JSON (without any duplicate fields).
How to reproduce
This code...
...Sends this request body to the Graph service the client is pointed to:
This also happens with other fields in the Application class when set explicitly to null.
SDK Version
5.65.0
Latest version known to work for scenario above?
5.56.0
Known Workarounds
No response
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: