From 56585a6a9cff0bc854a6a60bbd9ee62aac583ab3 Mon Sep 17 00:00:00 2001 From: Layomi Akinrinade Date: Fri, 28 Aug 2020 13:39:17 -0700 Subject: [PATCH] Update IgnoreNullValues obsoletion message (#41141) * Update IgnoreNullValues obsoletion message * Add attributes to ref file --- src/libraries/System.Text.Json/ref/System.Text.Json.cs | 2 ++ .../src/System/Text/Json/Serialization/JsonSerializerOptions.cs | 2 +- src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Text.Json/ref/System.Text.Json.cs b/src/libraries/System.Text.Json/ref/System.Text.Json.cs index 7735e6a..0e70895 100644 --- a/src/libraries/System.Text.Json/ref/System.Text.Json.cs +++ b/src/libraries/System.Text.Json/ref/System.Text.Json.cs @@ -217,6 +217,8 @@ namespace System.Text.Json public System.Text.Json.Serialization.JsonIgnoreCondition DefaultIgnoreCondition { get { throw null; } set { } } public System.Text.Json.JsonNamingPolicy? DictionaryKeyPolicy { get { throw null; } set { } } public System.Text.Encodings.Web.JavaScriptEncoder? Encoder { get { throw null; } set { } } + [System.ObsoleteAttribute("To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", false)] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public bool IgnoreNullValues { get { throw null; } set { } } public bool IgnoreReadOnlyFields { get { throw null; } set { } } public bool IgnoreReadOnlyProperties { get { throw null; } set { } } 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 4217f61..7f253e4 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 @@ -208,7 +208,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("To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingDefault.", error: false)] + [Obsolete("To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", error: false)] [EditorBrowsable(EditorBrowsableState.Never)] public bool IgnoreNullValues { diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj index 2f8a4ff..6e1e66c 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj @@ -1,7 +1,9 @@ - + $(NetCoreAppCurrent);net461 true + + CS0618 -- 2.7.4