Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3456 FN: Support utf-8 literals #6392

Closed
cristian-ambrosini-sonarsource opened this issue Nov 21, 2022 · 0 comments · Fixed by #6450
Closed

Fix S3456 FN: Support utf-8 literals #6392

cristian-ambrosini-sonarsource opened this issue Nov 21, 2022 · 0 comments · Fixed by #6450
Assignees
Labels
Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@cristian-ambrosini-sonarsource
Copy link
Contributor

cristian-ambrosini-sonarsource commented Nov 21, 2022

Description

FN for S3456 (RedundantToCharArrayCall).

Using C#11 utf-8 string literals, the rule is not raising an issue.

Repro steps

    public class RedundantToCharArrayCall
    {
        public void MyMethod(int propertyValue)
        {
            var c = "some string"u8.ToArray()[10];        // FN     
            foreach (var v in "some string"u8.ToArray())  // FN
            {
                // ...
            }
        }
    }

Expected behavior

The rule should raise an issue.

Actual behavior

The rule does not raise an issue.

@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource added Type: False Negative Rule is NOT triggered when it should be. Area: C# 11 labels Nov 21, 2022
@csaba-sagi-sonarsource csaba-sagi-sonarsource added this to the 8.50 milestone Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants