Skip to content

ResxSourceGenerator does not generate public format methods when Public="true" is set #7452

Open
@DavidBeh

Description

Source Generators

Nuget Package

NuGet Package: Microsoft.CodeAnalysis.ResxSourceGenerator

Version: 3.11.0-beta1.24454.1

Describe the bug

Configuring a Ressource File with Public="true" makes only the getters public (or rather the class is made public, the getters are always public and format methods are always internal)

Steps To Reproduce

Add a ressource file with arguments and configure the analyzer:

...
    <ItemGroup>
        <PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="3.11.0-beta1.24454.1">
          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
          <PrivateAssets>all</PrivateAssets>
        </PackageReference>
        <EmbeddedResource Update="**/*.resx" Public="true" EmitFormatMethods="true"/>
    </ItemGroup>
...

Example Ressource string with argument: This {addressType} address does to conform to expected requirements.

Expected behavior

Format Methods are public

Actual behavior

Format Methods are internal

Personal suggestion for fix

Replace internal with public in this line:

Activity

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