From 2d343933de876291bc58403b0b0243a988731d15 Mon Sep 17 00:00:00 2001 From: Layomi Akinrinade Date: Fri, 22 May 2020 17:49:34 -0400 Subject: [PATCH] Improve obsoletion message for IgnoreNullValues (#36886) --- .../src/System/Text/Json/Serialization/JsonSerializerOptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs index 27dc1fe..05b2aec 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs @@ -199,7 +199,7 @@ namespace System.Text.Json /// Thrown if this property is set after serialization or deserialization has occurred. /// or has been set to a non-default value. These properties cannot be used together. /// - [Obsolete("Use DefaultIgnoreCondition instead.", error: false)] + [Obsolete("To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingDefault.", error: false)] [EditorBrowsable(EditorBrowsableState.Never)] public bool IgnoreNullValues { @@ -211,7 +211,7 @@ namespace System.Text.Json { VerifyMutable(); - if (value == true && _defaultIgnoreCondition != JsonIgnoreCondition.Never) + if (value && _defaultIgnoreCondition != JsonIgnoreCondition.Never) { Debug.Assert(_defaultIgnoreCondition == JsonIgnoreCondition.WhenWritingDefault); throw new InvalidOperationException(SR.DefaultIgnoreConditionAlreadySpecified); -- 2.7.4