Problem
FFS0024 (LoggerParametersOnLeafClassesShouldUseGenericLoggerCategory) currently fires in unit test assemblies. In FunFair.Test.Common, the MockLogger class wraps the non-generic ILogger interface directly (it is a mock, not injected via DI), so it legitimately cannot use the generic ILogger<TCategoryName>.
Currently this requires a suppression:
[SuppressMessage("FunFair.CodeAnalysis", "FFS0024: ...", Justification = "...")]
This suppression itself triggers FFS0049, which is why a whitelist entry was added to SuppressMessageDiagnosticsAnalyzer. This is a layered workaround.
Solution
In ConstructorGenericParameterTypeDiagnosticsAnalyser (which raises FFS0024), add a check for IsUnitTestAssembly() and skip the diagnostic when the compilation is a unit test assembly.
Once done, the corresponding whitelist entry for FFS0024 in SuppressMessageDiagnosticsAnalyzer.AllowedSuppressions should be removed.
Problem
FFS0024(LoggerParametersOnLeafClassesShouldUseGenericLoggerCategory) currently fires in unit test assemblies. InFunFair.Test.Common, theMockLoggerclass wraps the non-genericILoggerinterface directly (it is a mock, not injected via DI), so it legitimately cannot use the genericILogger<TCategoryName>.Currently this requires a suppression:
This suppression itself triggers
FFS0049, which is why a whitelist entry was added toSuppressMessageDiagnosticsAnalyzer. This is a layered workaround.Solution
In
ConstructorGenericParameterTypeDiagnosticsAnalyser(which raises FFS0024), add a check forIsUnitTestAssembly()and skip the diagnostic when the compilation is a unit test assembly.Once done, the corresponding whitelist entry for FFS0024 in
SuppressMessageDiagnosticsAnalyzer.AllowedSuppressionsshould be removed.