You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UseResManager=false + [ResxSettings] class-spec generates typeof(resx filename) instead of the declared class #7
With ResXFileCodeGenerator_UseResManager=false, a class-spec resource file ([ResxSettings(...)] public partial class ...) produces a ResourceManager whose assembly argument is typeof(<resx file base name>), not the declared partial class.
Repro from the .NET 11 migration in Catglobe/Catglobe#1584 (Catglobe.ResXFileCodeGenerator 4.1.2):
TimesetEnumerations.resx + [ResxSettings(ForEnum = typeof(TimesetType))] public partial class TimesetTypeResources;
Generated: new ResourceManager("CatGlobe.Domain.Timesets.TimesetEnumerations", typeof(TimesetEnumerations).Assembly)
Result: CS0246: The type or namespace name 'TimesetEnumerations' could not be found.
Same for Resources.resx (CS0118) and bulkmailvariable.resx.
Cause
In StringBuilderGenerator.Generate, the class-spec path sets containerClassName = options.ClassName, where options.ClassName is the resx file base name. GenerateResourceManagerMembers uses containerClassName for typeof(...). The non-class-spec path generates a type with that name, so it only breaks when the class is declared by [ResxSettings].
Expected
Use the declared class name (classSpec.SymbolReference.TheType.TypeSymbol.Name, or the generated container class) for typeof(...), and add a regression test that compiles [ResxSettings] + UseResManager=false.
Context
Catglobe/ServiceDefaults 8.5.0-beta.1 moved the generator defaults from buildTransitive/*.targets to .props, so a consumer's UseResManager=false now takes effect and hits this path. Reported in Catglobe/ServiceDefaults#557. Workaround used in the migration PR: remove the consumer override.
Activity
fix: use declared class type for ResourceManager assembly (#8)
davhdavh commentedon Dec 3, 2026
Released fix in 4.2.0