diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/InitializeStaticFieldsInline.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/InitializeStaticFieldsInline.cs index 053233bf602..4251b906e48 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/InitializeStaticFieldsInline.cs +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/InitializeStaticFieldsInline.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.IO; +using System.Reflection; using System.Resources; using System.Globalization; @@ -160,4 +161,16 @@ static ReproSwitchMulti() // Compliant, because there are multiple variable a } } } + + public static class TestUtil + { + // https://github.com/SonarSource/sonar-dotnet/issues/6343 + static TestUtil() // Noncompliant - FP, there are no static fields + { + if (!Directory.Exists("")) + { + Directory.CreateDirectory(""); + } + } + } }