Fix identifiers generated from resx resource names#2208
Conversation
|
We intentionally didn't do this for CoreFx because we want folks to use resource IDs that are valid identifiers rather than have some transformation that has to be reversed when translating between identifier and resource ID. Does someone have a valid scenario for a resource ID that must be illegal identifier syntax? |
|
The problem is that we have tons of existing resources. Switching Roslyn from the default resource generation to Arcade's produced bad source files. Some resource names used in Roslyn have Alternatively we could report error and change the resx files. Then we would need pretty much the same logic. |
|
I see. IMHO I'd prefer an error, that way you let a human choose the identifier they want in their source, but I don't feel too strongly about it. |
| [InlineData("A\u0660\u2040\u0601\u0300\u0903", "A\u0660\u2040\u0601\u0300\u0903")] | ||
| public void GetIdentifierFromResourceName(string name, string expectedIdentifier) | ||
| { | ||
| Assert.Equal(expectedIdentifier, GenerateResxSource.GetIdentifierFromResourceName(name)); |
There was a problem hiding this comment.
This is failing to build: missing internals visible to?
|
@tmat -- what is the status on this? |
|
I don't have bandwidth to finish this right now. Will get back to it later. |
|
@tmat -- just poking again to see how this is going. Do you think you'll be picking this back up soon? If not, I think we probably ought to close it. |
|
Keep it open please. |
|
@tmat Should we keep this open? |
|
Yes please. I'll get back to it some day. |
|
@tmat WPF seems broken by this (See https://dev.azure.com/dnceng/public/_build/results?buildId=475850&view=results) Our generated resource files have bad const string lines like this: FYI @vatsan-madhavan |
|
@tmat seems like missed removing trailing parentheses here: I'll create a PR to fix this. |
|
Yes, my bad! I tested my change and then I did one "minor" tweak and did not test it again - because it was "just" a minor tweak :-| |
* Fix identifiers generated from resx resource names * Make AggressiveInlining NET20 conditional (cherry picked from commit 7af51d4)
No description provided.