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

[Group 4] Enable nullable annotations for Microsoft.Extensions.Logging.TraceSource #66892

Merged
merged 5 commits into from
Mar 25, 2022

Conversation

maxkoshevoi
Copy link
Contributor

Related to #43605

Questions:

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Mar 19, 2022
@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Mar 19, 2022

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

Issue Details

Related to #43605

Questions:

Author: maxkoshevoi
Assignees: -
Labels:

new-api-needs-documentation, area-Extensions-Logging, community-contribution

Milestone: -

@eerhardt
Copy link
Member

BeginScope should be annotated with where TState : notnull, but it cannot, since it's not annotated this way in ILogger

We can still change it in ILogger, if that is the correct thing to do. Doing a real quick look, I think it is.

BeginScope should also be annotated as returning IDisposable? because there are multiple places that return null:

public IDisposable BeginScope<TState>(TState state)
{
return _externalScopeProvider?.Push(state);
}

https://github.com/dotnet/aspnetcore/blob/17695facaeaf9d6d83aea9bfe87747180922117a/src/Logging.AzureAppServices/src/BatchingLogger.cs#L21-L24

@eerhardt
Copy link
Member

Microsoft.Extensions.Logging.EventLog cannot be annotated since System.Diagnostics.EventLog is not annotated yet. Should something be done about it, or let it be for now?

@maxkoshevoi - is annotating System.Diagnostics.EventLog something you would be interested in doing as well? If not, that is totally fine.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Just two tiny comments.

@maxkoshevoi
Copy link
Contributor Author

maxkoshevoi commented Mar 25, 2022

is annotating System.Diagnostics.EventLog something you would be interested in doing as well? If not, that is totally fine.

Sure, I was running out of things to annotate anyway 😄
Does this apply to System.Security.Cryptography.Xml too (prerequisite for annotating Microsoft.Extensions.Configuration.Xml)?

@eerhardt
Copy link
Member

Does this apply to System.Security.Cryptography.Xml too?

For Microsoft.Extensions.Configuration.Xml, I only know of 1 place that uses System.Security.Cryptography.Xml:

protected virtual XmlReader DecryptDocumentAndCreateXmlReader(XmlDocument document)
{
// Perform the actual decryption step, updating the XmlDocument in-place.
EncryptedXml encryptedXml = _encryptedXmlFactory?.Invoke(document) ?? new EncryptedXml(document);
encryptedXml.DecryptDocument();
// Finally, return the new XmlReader from the updated XmlDocument.
// Error messages based on this XmlReader won't show line numbers,
// but that's fine since we transformed the document anyway.
return document.CreateNavigator().ReadSubtree();
}

I think it would be pretty easy to nullable annotate Microsoft.Extensions.Configuration.Xml without having System.Security.Cryptography.Xml annotated.

But if you wanted to annotate System.Security.Cryptography.Xml, we should check with @bartonjs before starting on it, to be sure he would be open to accepting a PR to nullable annotate it.

@bartonjs
Copy link
Member

But if you wanted to annotate System.Security.Cryptography.Xml, we should check with @bartonjs before starting on it, to be sure he would be open to accepting a PR to nullable annotate it.

Yeah. It's not SO dead that we're not willing to nullable annotate it. 😄 (In fact, there's an open PR for fixing a bug in it.)

@maryamariyan maryamariyan merged commit a6d2b10 into dotnet:main Mar 25, 2022
@eerhardt
Copy link
Member

@maryamariyan - did the CI run for this PR?

Copy link
Member

@maryamariyan maryamariyan left a comment

Choose a reason for hiding this comment

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

LGTM. @eerhardt not sure what happened with the CI here.

@ghost ghost locked as resolved and limited conversation to collaborators May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Logging community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants