dotnet/roslyn

'Convert to raw string without leading whitespace' erroneously strips trailing whitespace

Open

#62,376 opened on Jul 5, 2022

View on GitHub
 (7 comments) (0 reactions) (1 assignee)C# (4,257 forks)batch import
Area-IDEBughelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

Version Used: 17.3.0-p2.0

This is not the semantics change described by the light bulb fix.

var whereClause = "Age >= 18";

var x = @"
    select FirstName, LastName
    from dbo.People
    where " + whereClause;

💡 "Convert to raw string without leading whitespace (may change semantics)":

var whereClause = "Age >= 18";

var x = """
    select FirstName, LastName
    from dbo.People
    where
    """ + whereClause;

The resulting string contains whereAge >= 18 instead of where Age >= 18.

Contributor guide