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
As we have applications that are localized through simple resx-Strings (with multiple corresponding resx files for different languages), or contain larger texts with placeholders in resx (that both get ultimatively get passed to string.Format) it would be great to have the analyzer check all corresponding strings, to ensure they're all correctly written. (Should also apply for single/neutral language resx).
Describe suggestions on how to achieve the rule
Not sure if a mechanism like this already exists, but:
add resx to AdditionalFiles, so the Analyzer has access to them(?)
optionally enable a editorconfig option, if that feature should not be enabled by default
instead of returning, check that setting
check if it is instead a PropertyReference to a string of a resource class
determine the corresponding resx file(s) ("the magic")
parse (or cache) the resx as such, and find the corresponding value to the key/property
check the value the same as you would the const
Additional context
(none)
The text was updated successfully, but these errors were encountered:
Analyzer
Diagnostic ID: CA2241
Describe the improvement
currently, the Analyzer only checks for constants:
roslyn-analyzers/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/ProvideCorrectArgumentsToFormattingMethods.cs
Lines 70 to 76 in 0aef54f
As we have applications that are localized through simple
resx
-Strings (with multiple correspondingresx
files for different languages), or contain larger texts with placeholders inresx
(that both get ultimatively get passed tostring.Format
) it would be great to have the analyzer check all corresponding strings, to ensure they're all correctly written. (Should also apply for single/neutral languageresx
).Describe suggestions on how to achieve the rule
Not sure if a mechanism like this already exists, but:
Additional context
(none)
The text was updated successfully, but these errors were encountered: