Skip to content

Conversation

@pranavkm
Copy link
Contributor

Fixes #22992

@pranavkm
Copy link
Contributor Author

I'm half tempted to turn off nullability warnings from tests. They are useful to help "figure out" the implementation at times, but not particularly high value. We could consider that if this is a recurrent problem.

@Pilchie Pilchie added area-healthchecks Includes: Healthchecks (some bugs also in Extensions repo) area-servers labels Jun 18, 2020
Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

Eight warnings from tasks outside msbuild. Wahoo 🥇

var builder = new ApplicationBuilder(serviceProvider: null);
var noMiddleware = new ApplicationBuilder(serviceProvider: null).Build();
var builder = new ApplicationBuilder(serviceProvider: null!);
var noMiddleware = new ApplicationBuilder(serviceProvider: null!).Build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion only: Seem to be working around the nullability of this constructor parameter a fair amount. Might be easier to either provide a default constructor or allow null in this constructor for testing purposes. Either way, shouldn't need to change the type of the ApplicationServices property (though it's odd the ApplicationBuilder properties aren't nullable given GetProperty(...) can return null).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I can do that in a follow up. Let's get this PR in

Copy link
Member

Choose a reason for hiding this comment

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

The API is very inconsistent.

  1. Adding a parameterless constructor would simplify usage in tests.
  2. ApplicationServices_Get should return a static no-op instance rather than null.
  3. ServerFeatures should also return a read-only no-op instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Captured this in a separate feedback. #23232.

@pranavkm pranavkm merged commit a44c1ad into master Jun 18, 2020
@pranavkm pranavkm deleted the prkrishn/fixup-nullable branch June 18, 2020 18:05
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-healthchecks Includes: Healthchecks (some bugs also in Extensions repo) area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix nullable warnings when building test code

6 participants