Skip to content

Can not satisfy SA1649 "File name should match first type name" when type name contains backslash on Windows #3907

Closed

Description

@Arthri

Assume that a file, Namee.cs, exists and has the following contents,

// \u0065 is 'e', but the same happens with other characters such as
// \u200B or zero-width space
class Name\u0065;

It is impossible to satisfy this condition on Windows because \ is not permitted in file names. A solution is to expand the escape making the declaration class Namee, but sometimes that is not desirable, especially with more exotic characters.

Activity

  1. julealgon commented on Nov 29, 2024

    @julealgon

    A solution is to expand the escape making the declaration class Namee, but sometimes that is not desirable, especially with more exotic characters.

    Why would it not be desirable?

  2. Arthri commented on Nov 29, 2024

    @Arthri
    Author

    Characters in non-Latin scripts such as Arabic may not display correctly on all computers

  3. julealgon commented on Nov 29, 2024

    @julealgon

    Characters in non-Latin scripts such as Arabic may not display correctly on all computers

    If you had characters such as that in your source code, wouldn't installing whatever was needed to display them properly be a development requirement for that particular project?

  4. Arthri commented on Nov 29, 2024

    @Arthri
    Author

    It was simply an example. The issue is still about the lack of handling or behavior regarding Unicode character escapes in type identifiers

  5. sharwell commented on Dec 4, 2024

    @sharwell
    Member

    This case seems sufficiently obscure that a pragma suppression would suffice. We should at minimum allow the issue to be resolved by evaluating the escape sequence, but I'm not sure further handling is warranted.

  6. moved this from In progress to Done in StyleCopAnalyzerson Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions