Skip to content

String concat does not handle escaped characters properly #23

@kevygreen

Description

@kevygreen

Thanks for the addition of the string concatenation refactoring! I really appreciate the effort.

The string concatenation to message template refactor doesn't seem to work when there are newlines or other escaped characters in the text. I think think might be because of L67 of ConvertToMessageTemplateCodeRefactoringProvider.StringConcat.cs

sb.Append(literal.Token.ValueText);

because I think it is then evaluated here:

format = (InterpolatedStringExpressionSyntax)SyntaxFactory.ParseExpression(sb.ToString());

and those are treated as newlines in the code vs the escape value string or something...

e.g. this:

_log4.Debug("RegisterRecorder called with the following parameters: \n FDQN: '" + fqdn + "' \n Guid: '" + id + "' \n Modalities: '" + modalitiesWithCapacity + "' \n URI: '" + uri + "' \n supportedModes: '" + supportedMethods + "' ");

transforms to this:

_log4.Debug("RegisterRecorder called with the following parameters: ");

I'm not really sure how to debug this, but if I can help let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions