Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

[release/3.1] JsonSerializer.Serialize should check whether the passed-in Utf8JsonWriter is null. #42027

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

ahsonkhan
Copy link
Member

Porting #42026

Description

Add null checks for the Utf8JsonWriter argument being passed in to the JsonSerializer.Serialize overloads.

Customer Impact:

Instead of user potentially seeing a NullReferenceException, they now get a more friendly ArgumentNullException. I'd put this type of fix in general reliability improvement.

Regression?

No

Risk

Low. The change is really straight forward (basic argument validation and moving to a user-friendly exception). No one should be depending on NullReferenceException.

Tests run / added

Basic test added.

cc @steveharter, @ericstj, @danmosemsft

@ahsonkhan ahsonkhan added this to the 3.1 milestone Oct 23, 2019
@ahsonkhan ahsonkhan added the Servicing-consider Issue for next servicing release review label Oct 23, 2019
@ahsonkhan
Copy link
Member Author

Unrelated test failure on Windows Build x64_Debug, specifically netcoreapp-Windows_NT-Debug-x64-(Windows.Nano.1809.Amd64.Open) https://github.com/dotnet/corefx/issues/42060

@ahsonkhan
Copy link
Member Author

@danmosemsft - what are your thoughts on this?

@danmoseley danmoseley added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 23, 2019
@danmoseley
Copy link
Member

Approved. This is marginal, since the impact is low. However it's very low risk and increases the consistency of this new API.

@danmoseley danmoseley merged commit 427c7bd into dotnet:release/3.1 Oct 23, 2019
@danmoseley
Copy link
Member

@ahsonkhan confirmed offline that this is definitely going to throw already in this codepath.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants