The S2857 Rule says to add spaces around a table name which is included by string interpolation in csharp
i.e
const string tableName = "MyTableName";
const string strQuery = $"SELECT * FROM [{tableName}] ";
states to change to
const string tableName = "MyTableName";
const string strQuery = $"SELECT * FROM [ {tableName} ] ";
This is a failure in sqlite as the spaces then means the select statement does not work
In this case the [ and ] could be omitted of course , but are included as the table may may be defined elsewhere.
The same error occurs however with
const string tableName = "My Table Name";
const string strQuery = $"SELECT * FROM [{tableName}] ";
(I make no comment on the practice of having spaces in table names !)
This looks similar to a April 2024 complaint about string literals ? Repro for Fix S2857 FP: Multiple FP on String Interpolation with Verbatim Literal by martin-strecker-sonarsource · Pull Request #9181 · SonarSource/sonar-dotnet · GitHub