Skip to content

ResxSourceGenerator creates invalid "Format method" name when resource name contains invalid characters #7536

Open
@Andrzej-W

Description

@Andrzej-W

NuGet Package: Microsoft.CodeAnalysis.ResxSourceGenerator

Version: 3.11.0-beta1.24605.2

Describe the bug

Resource name can contain characters which are invalid in C# identifier. Generator does not change them to underscores in Format methods.

Steps To Reproduce

Create resource name with invalid characters, for example Name.with.dots. Enable Format methods in project file:

  <ItemGroup>
    <EmbeddedResource Update="**/*.resx">
      <EmitFormatMethods>true</EmitFormatMethods>
    </EmbeddedResource>
  </ItemGroup>

Expected behavior

Format method should have the name FormatName_with_dots

Actual behavior

Format method have the name FormatName.with.dots

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