Skip to content

Add nullability to HtmlAbstractions #22275

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

Merged
1 commit merged into from
Jun 2, 2020
Merged

Conversation

pranavkm
Copy link
Contributor

Addresses #5680

@pranavkm pranavkm force-pushed the prkrishn/html-abstractions-nullable branch from eae6511 to 1068121 Compare May 27, 2020 16:13
@pranavkm pranavkm marked this pull request as ready for review May 27, 2020 20:22
@pranavkm pranavkm requested review from JamesNK and dougbu May 27, 2020 20:22
@JamesNK
Copy link
Member

JamesNK commented May 27, 2020

Nice.

Is there a reason you picked this project? Adding annotations from the bottom up, i.e. projects with few or no dependencies, will create the least churn. This project doesn't seem to have any dependencies so you might already be doing that 😄

@pranavkm
Copy link
Contributor Author

Yeah, I picked it because it was fairly low on the stack. I was planning on looking at Antiforgery, Auth, and CORS middleware next.

@JamesNK
Copy link
Member

JamesNK commented May 27, 2020

Ok!

If you're going to start tackling nullability across the stack then I have a WIP PR that never got merged for low-level HTTP bits: #18084

@Pilchie Pilchie added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 27, 2020
@pranavkm pranavkm added the api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews label May 28, 2020
@ghost
Copy link

ghost commented May 28, 2020

Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:

  • The PR contains changes to the reference-assembly that describe the API change. Or, you have included a snippet of reference-assembly-style code that illustrates the API change.
  • The PR describes the impact to users, both positive (useful new APIs) and negative (breaking changes).
  • Someone is assigned to "champion" this change in the meeting, and they understand the impact and design of the change.

Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

PR looks good.

One process thing I'd like to sort out before starting to merge is what would happen if we decide at some point that we don't want nullable annotations for 5.0. For example, perhaps we run out of time and don't want a mix of annotated and not annotated.

Do we need a rollback strategy? Is there a configuration setting that can be applied to a project that allows nullable annotations during compilation but doesn't include them with the output assembly. A project wide setting would be much preferable to striping annotations out.

@halter73
Copy link
Member

Do we need a rollback strategy? Is there a configuration setting that can be applied to a project that allows nullable annotations during compilation but doesn't include them with the output assembly. A project wide setting would be much preferable to striping annotations out.

That's a good question. Removing nullable reference types from our projects at the last second does sound annoying. @jaredpar Do you know of an easy way to remove nullable reference annotations from the compiled output of an entire project?

@dougbu
Copy link
Contributor

dougbu commented May 29, 2020

Do we need a rollback strategy?

Couldn't we "just" revert all of the commits for nullability additions? In anything but an extreme emergency, I expect this shouldn't be horribad because other changes are much more likely to be in the middle of methods.

@jaredpar
Copy link
Member

The simplest approach would be to do the following:

  1. Change to <Nullable>disabled</Nullable>
  2. Suppress the warning about using ? inside a disabled nullable context.

That is a pretty targeted change you could make to disable nullable annotations.

That being said why not just ship in a partially annotated state? Sure the customer doesn't get full value from nullability but they will get more value than what they're getting without any annotations. The only issue would be communicating to customers that you're not finished and future releases would potentially add more annotations.

This is the approach we're likely to take with the Roslyn APIs.

@JamesNK
Copy link
Member

JamesNK commented May 29, 2020

It is unlikely we'd disable annotations, being halfway done was a hypothetical reason, I just want to understand our options before making wide ranging changes to source code.

The approach you've mentioned sounds good.

@ghost
Copy link

ghost commented Jun 1, 2020

Hello @pranavkm!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@pranavkm pranavkm force-pushed the prkrishn/html-abstractions-nullable branch from 498ce6f to d9a05d3 Compare June 2, 2020 13:50
@ghost ghost merged commit faf6067 into master Jun 2, 2020
@ghost ghost deleted the prkrishn/html-abstractions-nullable branch June 2, 2020 23:27
{
destination.Append(entryAsString);
}
else if ((entryAsContainer = entry as IHtmlContentContainer) != null)
Copy link
Member

Choose a reason for hiding this comment

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

booooooooooo......... My jank-mode code from the 70s should live on.

@pranavkm pranavkm removed the api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews label Mar 22, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants