microsoft / microsoft/microsoft-ui-xaml
XAML parser deletes valid Lo (Other Letter) characters
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Describe the bug
In XAML, refer to a property that has Unicode Lo (Other Letter) characters in it:
<f:InputBox Source="{x:Bind Holdⵙᐁ.Preferences.ShowHidden, Mode=OneWay, FallbackValue={x:Null}}" />
Here the Other Letter characters are ⵙ which is Unicode U+2D59, Tifinagh Letter Yas, and ᐁ which is Unicode U+1401, Canadian Syllabics E. Both are valid characters for a XAML identifier under the specification, since they are both in Unicode category Lo (Other Letter). These letters are also correctly accepted in C# identifiers by Roslyn.
In code-behind, create Holdⵙᐁ and Hold properties:
public HoldablesPageⵙᐁ Holdⵙᐁ => (HoldablesPageⵙᐁ)base.TargetViewModel;
public string Hold => "Hi";
The supporting class HoldablesPageⵙᐁ should be defined with a Preferences property.
Compiling, observe the error stating that Preferences is not a property on string. Since the type HoldablesPageⵙᐁ does have a Preferences property, this demonstrates that the wrong property, Hold, is being bound to instead of the correct property, Holdⵙᐁ.
Why is this important?
This creates a situation where valid C# identifiers run into a logjam when there is a need to refer to them in XAML.
The specification is not implemented correctly.
Yes I actually do want to use these characters in XAML!
Steps to reproduce the bug
See description above.
Actual behavior
XAML picks up the property name omitting the non-Latin characters.
Expected behavior
XAML should follow the spec and recognize all Lo (Other Letter) characters in identifiers.
Screenshots
No response
NuGet package version
VS version 18.7.0, Windows App SDK 2.2.0, TFM .NET 10.0
Windows version
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the XAML binding with the Holdⵙᐁ and Hold properties, then trace the XAML identifier parsing and name-resolution path. Compare its handling of Unicode Lo characters with the XAML name grammar and add a regression test; done means the binding resolves Holdⵙᐁ and its Preferences property rather than Hold.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100