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
When using string interpolation together with verbatim literal we get multiple false positives reported.
Repro steps
stringsqlQuery=$@" SELECT [Artifact].[Id] AS [{nameof(ArtifactDto.Id)}], [Artifact].[TagIdentifier] AS [{nameof(ArtifactDto.TagIdentifier)}], [Artifact].[DomainSpecificId] AS [{nameof(ArtifactDto.DomainSpecificId)}], [Artifact].[TagReplacements] AS [{nameof(ArtifactDto.TagReplacements)}], [Artifact].[LocationId] AS [{nameof(ArtifactDto.LocationId)}], [Location].[Name] AS [{nameof(ArtifactDto.LocationName)}] FROM [Artifacts] AS [Artifact] JOIN [Locations] AS [Location] ON [Artifact].[LocationId] = [Location].[Id]";
Expected behavior
Expected to have no issues raised by analyzer on this piece of code as when using debugger it shows exactly the parsed string contains enough whitespace to be valid SQL.
Actual behavior
12 issues are raised by the analyzer:
Add a space before 'Id' on {nameof(ArtifactDto.Id)}
Add a space before '],' on ArtifactDto.Id)}],
Add a space before 'TagIdentifier' on {nameof(ArtifactDto.TagIdentifier)}
Add a space before '],' on ArtifactDto.TagIdentifier)}],
Add a space before 'DomainSpecificId' on {nameof(ArtifactDto.DomainSpecificId)}
Add a space before '],' on ArtifactDto.DomainSpecificId)}],
Add a space before 'TagReplacements' on {nameof(ArtifactDto.TagReplacements)}
Add a space before '],' on ArtifactDto.TagReplacements)}],
Add a space before 'LocationId' on {nameof(ArtifactDto.LocationId)}
Add a space before '],' on ArtifactDto.LocationId)}],
Add a space before 'LocationName' on {nameof(ArtifactDto.LocationName)}
Add a space before '],' on ArtifactDto.LocationName)}],
Known workarounds
N/A
Related information
C#/VB.NET Plugins version: C#12
Visual Studio version: VS2022 (17.9.6)
MSBuild / dotnet version: MSBuild version 17.9.6+a4ecab324 for .NET / dotnet 8.0.204
SonarScanner for .NET version (if used): sonar-dotnet analyzer 9.23.1.88495
Operating System: Windows 10 Pro 22H2
The text was updated successfully, but these errors were encountered:
Description
When using string interpolation together with verbatim literal we get multiple false positives reported.
Repro steps
Expected behavior
Expected to have no issues raised by analyzer on this piece of code as when using debugger it shows exactly the parsed string contains enough whitespace to be valid SQL.
Actual behavior
12 issues are raised by the analyzer:
Add a space before 'Id' on
{nameof(ArtifactDto.Id)}
Add a space before '],' on
ArtifactDto.Id)}],
Add a space before 'TagIdentifier' on
{nameof(ArtifactDto.TagIdentifier)}
Add a space before '],' on
ArtifactDto.TagIdentifier)}],
Add a space before 'DomainSpecificId' on
{nameof(ArtifactDto.DomainSpecificId)}
Add a space before '],' on
ArtifactDto.DomainSpecificId)}],
Add a space before 'TagReplacements' on
{nameof(ArtifactDto.TagReplacements)}
Add a space before '],' on
ArtifactDto.TagReplacements)}],
Add a space before 'LocationId' on
{nameof(ArtifactDto.LocationId)}
Add a space before '],' on
ArtifactDto.LocationId)}],
Add a space before 'LocationName' on
{nameof(ArtifactDto.LocationName)}
Add a space before '],' on
ArtifactDto.LocationName)}],
Known workarounds
N/A
Related information
The text was updated successfully, but these errors were encountered: