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

System.Text.Json source gen containing non-localized error messages #58292

Closed
eiriktsarpalis opened this issue Aug 27, 2021 · 2 comments · Fixed by #58993
Closed

System.Text.Json source gen containing non-localized error messages #58292

eiriktsarpalis opened this issue Aug 27, 2021 · 2 comments · Fixed by #58993

Comments

@eiriktsarpalis
Copy link
Member

For example

string exceptionMessage = @$"""Invalid serializable-property configuration specified for type '{typeRef}'. For more information, use 'JsonSourceGenerationMode.Serialization'.""";

We should find all such messages and localize them.

@eiriktsarpalis eiriktsarpalis added this to the 6.0.0 milestone Aug 27, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Text.Json untriaged New issue has not been triaged by the area owner labels Aug 27, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

For example

string exceptionMessage = @$"""Invalid serializable-property configuration specified for type '{typeRef}'. For more information, use 'JsonSourceGenerationMode.Serialization'.""";

We should find all such messages and localize them.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json, untriaged

Milestone: 6.0.0

@eiriktsarpalis eiriktsarpalis added blocking-release enhancement Product code improvement that does NOT require public API changes/additions and removed untriaged New issue has not been triaged by the area owner enhancement Product code improvement that does NOT require public API changes/additions labels Aug 27, 2021
@eiriktsarpalis eiriktsarpalis self-assigned this Sep 1, 2021
@steveharter
Copy link
Member

We need to determine if these error messages are displayed at design-time. If they occur at design-time they should be localized.

However, in the referenced example above, the exception with the non-localized message occurs at run-time within the generated code which I believe should not be localized because we don't localize other exception messages in STJ that occur at run-time. In theory, at run-time the generated code and STJ are interchangeable (logic could exist on either side, and may change in the future) and should be indistinguishable from the user and thus should throw non-localized exception messages.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 11, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 13, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.