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

[DataAnnotations] LocalizableString does not work with internal resource types #110073

Open
uo1 opened this issue Nov 22, 2024 · 1 comment
Open
Labels
area-System.ComponentModel.DataAnnotations untriaged New issue has not been triaged by the area owner

Comments

@uo1
Copy link

uo1 commented Nov 22, 2024

The class System.ComponentModel.DataAnnotations.LocalizableString that is used by the class System.ComponentModel.DataAnnotations.DisplayAttribute for localization, throws an InvalidOperationException when the given ResourceType is not public.
As you can see at line 132, this is by design, since IsVisible is explicitly checked to be true.
But from my point of view, this check does not make sense.
If I'm able to assign the ResourceType with a type I can access, it should just use that one, no matter if it is public or internal.
I noticed it in my project where I use the new Roslyn ResxSourceGenerator, that generates the resource classes als internal by default.
As a workaround I can configure it to create them as public.
But since I use those resources only inside the same assembly, I don't really want to make them public.
There was already a discussion in the issue #15794, but the explanation not to change that, because it always has been like that, is not very satisfying.
I would appreciate if it can be considered to simply remove the check for IsVisible on the ResourceType.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 22, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-componentmodel-dataannotations
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.ComponentModel.DataAnnotations untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant