Skip to content
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

Enable nullable annotations for M.E.L.Abstractions #43892

Merged
7 commits merged into from
Nov 18, 2020

Conversation

maryamariyan
Copy link
Member

@maryamariyan maryamariyan commented Oct 27, 2020

cc: @buyaa-n @safern

Related to #43605

@ghost
Copy link

ghost commented Oct 27, 2020

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

}

return _formatter.GetValue(_values, index);
return _formatter!.GetValue(_values!, index);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note for reviewer: _values is not null due to what Count returns on line 76

@@ -10,11 +10,11 @@ namespace Microsoft.Extensions.Logging
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public EventId(int id, string name = null) { throw null; }
Copy link
Member

Choose a reason for hiding this comment

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

please make sure owner of this library double checks the annotations of the ref

<EnableDefaultItems>true</EnableDefaultItems>
<!-- Use targeting pack references instead of granular ones in the project file. -->
<DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
Copy link
Member

Choose a reason for hiding this comment

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

Did you intend to check in these changes?

Copy link
Member Author

@maryamariyan maryamariyan Nov 4, 2020

Choose a reason for hiding this comment

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

yes this was intentional otherwise wouldn't have been able to add NetCoreAppCurrent for the project I think.

cc: @safern

Copy link
Member

Choose a reason for hiding this comment

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

The reason behind adding NetCoreAppCurrent for these projects was to have CI protection for the nullable annotations to actually be correct and not broken on by upcoming changes but to actually not ship that asset. However the only caveat that this brings is that by adding this I'm not sure if people can just clone the repo and build this project without pre building anything else which was an effort @ViktorHofer did in the past.

Copy link
Member

@ViktorHofer ViktorHofer Nov 11, 2020

Choose a reason for hiding this comment

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

yes this was intentional otherwise wouldn't have been able to add NetCoreAppCurrent for the project I think.

This property is for convenience only, in case you don't want to list all the individual assembly references. In this case I think it's fine as we don't ship the `$(NetCoreAppCurrent)' asset.

However the only caveat that this brings is that by adding this I'm not sure if people can just clone the repo and build this project without pre building anything

Unfortunately with our current infra that's true but I don't think we should see that as a blocker. I would like to improve our infra so that $(NetCoreAppCurrent) builds via dependencies without an up-front build which would also enable VS builds for .NETCoreApp without up-front steps.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

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

LGTM with some questions

@maryamariyan maryamariyan force-pushed the logging-abstractions-null branch 3 times, most recently from 70e6b56 to c3e738b Compare November 4, 2020 18:09
@maryamariyan
Copy link
Member Author

maryamariyan commented Nov 5, 2020

@stephentoub @krwq @tarekgh looked at all the comments and made all the changes I was planning to do.

I posed this question in #43892 (comment) too.

Would it be reasonable to restrict formatter argument in ILogger.Write(.., formatter) to be not nullable and make TraceSourceLogger consistent with the others through this change? (refer to API diff for making formatter not nullable)

let me know what you think.

@maryamariyan
Copy link
Member Author

Updates on PR since it was last reviewed:

  • Addressed PR feedback
  • LoggerExtensions.cs: params object?[] -> params object?[]
  • Last commit makes formatter non-nullable

@maryamariyan
Copy link
Member Author

@stephentoub @krwq could you please re-review?

@maryamariyan
Copy link
Member Author

maryamariyan commented Nov 12, 2020

perf legs usually don't run on PRs normally wonder why they showed up here.

cc: @ericstj

@safern is this something to be concerned about?

@ViktorHofer
Copy link
Member

cc @DrewScoggins

…ons-null

Conflicts:
	src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj
@ghost
Copy link

ghost commented Nov 17, 2020

Hello @maryamariyan!

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.

@ghost ghost merged commit fa06656 into dotnet:master Nov 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2020
@stephentoub
Copy link
Member

@maryamariyan, doesn't the ref csproj need <Nullable>enable</Nullable> as well?

This pull request was closed.
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.

5 participants