Skip to content

[release/5.0] Remove obsolete attribute from IgnoreNullValues - #41538

Merged
layomia merged 2 commits into
dotnet:release/5.0from
layomia:obsolete_5.0
Aug 30, 2020
Merged

layomia merged 2 commits into
dotnet:release/5.0from
layomia:obsolete_5.0

Conversation

@layomia

@layomia layomia commented Aug 28, 2020 •

Copy link
Copy Markdown
Contributor

Ports #41141 to release/5.0.

- We want to have an accurate message here so that users don't have bugs due to value-type defaults being unintentionally ignored on serialization.
- Also places the Obsolete and EditorBrowsable attributes on the property in the System.Text.Json ref file.

The attribute was not added to the ref file earlier in the release (so the obsoletion had little visibility), and at this point it is rather late to do so given the risk and disruption to upstack callers.

* Update IgnoreNullValues obsoletion message

* Add attributes to ref file
@layomia layomia added this to the 5.0.0 milestone Aug 28, 2020
@layomia
layomia requested a review from ericstj August 28, 2020 21:56
@layomia layomia self-assigned this Aug 28, 2020
@layomia layomia changed the title Update IgnoreNullValues obsoletion message (#41141) [release/5.0] Update IgnoreNullValues obsoletion message (#41141) Aug 28, 2020
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 { } }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to impact folks who target net5.0 and use this API. Prior to this change, only folks using the package will have seen the obsolete attribute. Have you identified all the places upstack that will need to change as a result of this and made sure folks are ready to react to the change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@layomia layomia Aug 28, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll collate a list and send out a broadcast message to folks, with a target of getting this change in on Tuesday. Will be sure to follow up on doc changes.

@ahsonkhan ahsonkhan Aug 29, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should defer marking this API as obsolete to early in 6.0, given the state of the 5.0 release and upstream impact. It isn't a security, perf, or correctness issue, so to me, not worth the trade-off.

If we really want to mark it as EditorBrowsableState.Never, that is fine. Doing that doesn't require upstack code changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue now is that it is inconsistently obsolete. When using the package folks get the obsolete warning but not when targeting ‘net5.0’ without the package. So we need to do something to make it consistent.

We could remove it from impl in 5.0 if the risk is too high.

We have rejected other new obsoletions at this point due to risk to the product.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove it from impl in 5.0 if the risk is too high.

+1

It makes sense to remove the obsolete from both ref and src (certainly for 5.0, and maybe even master). To me, it doesn't meet the bar for an obsoletion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I had for obsoleting IgnoreNullValues was that we added a better API (DefaultIgnoreCondition) to provide the desired semantics. Also, IgnoreNullValues applies to both serialization and deserialization which is not desired (we don't think there's a good reason to ignore null values when deserializing).

There's logic ensuring that IgnoreNullValues and DefaultIgnoreCondition cannot both be used in the same options instance, so there is technically not much value in obsoleting the type at this late stage in the the release.

I'm fine with removing the obsolete attribute for 5.0. I'll make the change in this PR. I think we need to discuss whether to remove it in 6.0 as well - I'll bring this up offline.

@layomia layomia changed the title [release/5.0] Update IgnoreNullValues obsoletion message (#41141) [release/5.0] Remove obsolete attribute from IgnoreNullValues Aug 29, 2020
@layomia
layomia merged commit 95baa7a into dotnet:release/5.0 Aug 30, 2020
@layomia
layomia deleted the obsolete_5.0 branch August 30, 2020 21:40
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants