dotnet / dotnet/roslyn

"HTML" name for ViewComponents and TagHelpers not generated correctly if class name contains extended letters

Open
#85,559 2 comments 0 reactions 0 assignees View on GitHub
Area-Razor Area-Razor-Compiler untriaged
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Class names in C# allow extended letters like ÅÄÖ. When using pascal casing and a new word begins with an extended letter like `TestÄa` the generated markup is wrong.

Steps to reproduce:
1. Create a `ViewComponent` with the class name `TestÄh`.
2. Generated markup to use it should be ``
3. Generated markup is ``

The actual issue is with the regex here:
https://github.com/dotnet/razor/blob/dde7fe8c2f3c2be154c631d281256cd153a0089e/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlConventions.cs#L23

Solution:
Change the regex so it supports extended letters just like class names do.

Contributor guide

Open the contributing guide

Research direction

Inspect src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlConventions.cs at the regex referenced in the issue, then reproduce the ViewComponent case with the extended-letter class name TestÄh. Done means generated markup recognizes the extended letter as a new Pascal-case word and produces the expected hyphenated, lower-case HTML name.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.