You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In an inheritance tree, I've seen a lot of people lazily satisfy the compiler and intellisense by passing in ILogger<base> instead, e.g.:
abstractclassMyBaseClass{publicMyBaseClass(ILogger<MyBaseClass>logger){}}classMyDerivedClass{publicMyDerivedClass(ILogger<MyBaseClass>logger){}// This should be ILogger<MyDerivedClass>}
We should detect this with a diagnostic and code fix.
The text was updated successfully, but these errors were encountered:
When using Microsoft.Extensions.Logging and Dependency Injection, a type
T
should typically be injected withILogger<T>
.For example:
This automatically configures the Category of the logs produced by this logger:
In an inheritance tree, I've seen a lot of people lazily satisfy the compiler and intellisense by passing in
ILogger<base>
instead, e.g.:We should detect this with a diagnostic and code fix.
The text was updated successfully, but these errors were encountered: