dotnet / dotnet/wpf

WPF Application FailFast in System.Windows.Controls.TextBoxView.GetFormattedLine when using Hebrew text and non-adorner based text selection

Open
#2,314 2 comments 2 reactions 0 assignees View on GitHub
.NET Framework Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

The WPF application is using a Textbox component with the text in Hebrew language. The text contain a combination of text and date and month separated by ‘/’. The application is crashing when the user select the ‘/’ along with the number(i.e. date and month). In Windows 10 1909, with the .Net Framework version 4.8 is the environment where the application is experiencing the crash.
 
**Steps to reproduce:**

Create a WPF application.
Use a Textbox with the below properties and text.

TextWrapping="Wrap" FlowDirection="RightToLeft" Margin="10" Text="נסה לסמן את הלוכסן שבין הספרות 07/1997 והתוכנה תקרוס"

(Text Translation: Try to mark the slash between the digits 07/1997 and the software will crash)
Set the window size as below

Height="200" Width="250"
Please the below code, in App.xaml.cs

private void Application_Startup(object sender, StartupEventArgs e)

{

AppContext.SetSwitch("Switch.System.Windows.Controls.Text.UseAdornerForTextboxSelectionRendering", false);

}
Please the below code in App.xaml

Startup="Application_Startup"
Run the application and select the text including the '/' in the text using the mouse.
The application will crash in few seconds

**Notes:**
1. This does appear to be specific to Hebrew. I was unable to reproduce this with Arabic, which is another RTL language.

2. RTL doesn't actually matter. You can use the same text and change from RTL to LTR. Still repros.

3. This is specific to non-adorner selection of text.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.