Skip to content

Commit

Permalink
Repro for S2629 on log4net.Error(Exception) (#9548)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-paidis-sonarsource authored Jul 23, 2024
1 parent c839979 commit ab314af
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void Method(ILogger logger, int arg)
[DataRow("Warn")]
public void UseConstantLoggingTemplate_Log4Net_CS(string methodName) =>
builder.AddSnippet($$"""
using System;
using log4net;
public class Program
Expand All @@ -74,6 +75,11 @@ public void Method(ILog logger, int arg)
logger.{{methodName}}Format("Arg: {0}", arg); // Compliant
logger.{{methodName}}Format($"{arg}"); // Noncompliant
}
void Repro_9547(ILog logger, string filePath, Exception ex)
{
logger.Error($"Error while loading file '{filePath}'!", ex); // Noncompliant FP
}
}
""").Verify();

Expand Down

0 comments on commit ab314af

Please sign in to comment.