[Group 4] Enable nullable annotations for Microsoft.Extensions.Logging.EventSource#66802
Conversation
|
Tagging subscribers to this area: @dotnet/area-extensions-logging Issue DetailsRelated to #43605 Questions:
|
I would try cleaning my repo: |
| { | ||
| public EventSourceLoggerProvider(Microsoft.Extensions.Logging.EventSource.LoggingEventSource eventSource) { } | ||
| public Microsoft.Extensions.Logging.ILogger CreateLogger(string categoryName) { throw null; } | ||
| public Microsoft.Extensions.Logging.ILogger CreateLogger(string? categoryName) { throw null; } |
There was a problem hiding this comment.
ILoggerProvider has categoryName as non-nullable. So this should be string categoryName.
We don't want to allow this to be null.
There was a problem hiding this comment.
Should EventSourceLogger.CategoryName be nullable then? Maybe it doesn't really matter sines it's an internal API, and nothing breaks when it's nullable, but still.
There was a problem hiding this comment.
Should EventSourceLogger.CategoryName be nullable then?
I would say no. If nothing ever creates it with a null name, then I wouldn't make it nullable.
src/libraries/Microsoft.Extensions.Logging.EventSource/src/LoggingEventSource.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Logging.EventSource/src/ExceptionInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Logging.EventSource/src/EventSourceLoggerProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Logging.EventSource/src/EventSourceLogger.cs
Outdated
Show resolved
Hide resolved
|
/azp run |
|
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
|
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
eerhardt
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution here, @maxkoshevoi!
| if (command.Command is EventCommand.Update or EventCommand.Enable) | ||
| { | ||
| if (!command.Arguments.TryGetValue("FilterSpecs", out string filterSpec)) | ||
| if (!command.Arguments!.TryGetValue("FilterSpecs", out string? filterSpec)) |
There was a problem hiding this comment.
This is the only place that concerns me. But if it hasn't been a problem, I guess we can just suppress the null check here. Looking around I see similar code elsewhere:
|
+1 we appreciate your hard work on all these annotations @maxkoshevoi . |
…ng.EventSource` (dotnet#66802) * Annotate src * Annotate ref * Make internal parameters non-nullable if they never receive null

Related to #43605
Questions:
Argumentscan be null hereruntime/src/libraries/Microsoft.Extensions.Logging.EventSource/src/LoggingEventSource.cs
Line 303 in 731d936
maindoesn't help. Is there something I'm missing?