Skip to content

Enabling SpellChecker in RichTextEditor causes text to become invisible [WPF] #1898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vsfeedback opened this issue Sep 16, 2019 · 11 comments
Labels
Bug Product bug (most likely)
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


I found an interesting problem for which I'm unable to find a fix for. Enabling the spellchecker in the RichTextBox component causes text to disappear randomly, sometimes whilst scrolling, sometimes whilst writing. The text is still there, it's just invisible. The invisible text can be selected, the caret can be placed in it, and writing causes it to become visible and sometimes the next line then becomes invisible. The code to reproduce is quite simple, all that is required is the RTB component with the spellchecker enabled. I was unable to find anything similar to this problem, is this a known issue? Is there a workaround?

 Code to reproduce (xaml): 
<Window x:Class="WpfTestRtb.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfTestRtb"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
        <Grid>
          <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <RichTextBox Grid.Column="0" Grid.Row="0" SpellCheck.IsEnabled="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" />
      </Grid>
</Window>

Code to reproduce (cs):

usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows;
usingSystem.Windows.Controls;
usingSystem.Windows.Data;
usingSystem.Windows.Documents;
usingSystem.Windows.Input;
usingSystem.Windows.Media;
usingSystem.Windows.Media.Imaging;
usingSystem.Windows.Navigation;
usingSystem.Windows.Shapes;
namespace WpfTestRtb
{     
       /// <summary>     
       /// Interaction logic for MainWindow.xaml     
       /// </summary>     
       publicpartialclassMainWindow:Window     
      {         
              publicMainWindow()         
              {             
                   InitializeComponent();        
              }     
      }
}

It's important to note that this error doesn't occur immediately, sometimes you have to write for a while for it to show up, but it does show up. One solution that I have found is that putting the RTB in a ScrollViewer causes the problem to go away. This is not something I can do, however, as from my understanding the scrollviewer breaks virtualization in the editor which slows the RTB down when there's a lot of text. I need the editor to retain its speed whilst showing spelling errors. A closing note, this happens in .NET version >= 4.0, I tested on 3.x and the error did not occur.

Example image #1, invisible text:

Image:92997-example-01.png

Example #2, the invisible text is selected:

Image:92998-example-02.png

Example #3, writing in the selection causes some of the lines to become visible:

Image:92999-example-03.png

I will also include sample RTF that causes this error:

rtf.zip


Original Comments

Nathan Kawalec on 9/13/2019, 03:00 PM:

I found another question with the same problem, the question is old and I don't think any workarounds were found (apart from not using the RTB).


Original Solutions

(no solutions)

@nathankawalec
Copy link

nathankawalec commented Sep 17, 2019

I'm available for brainstorming if anyone has any ideas :)
I've spent many hours on this specific error, I would love to see it die.

@weltkante
Copy link

It should be possible to debug this once the render engine becomes available.

@nathankawalec
Copy link

Ok, is there an expected timeline for that?

@weltkante
Copy link

I think someone mentioned the current plans somewhere in the preview update posts, but the roadmap document doesn't commit to any timeline. Note that I'm just commenting and not involved with Microsoft or the repository. Right now their priorities are with the upcoming 3.0 release next week, so I just wanted to drop a note that regardless of whether someone from Microsoft takes a look, once the render engine is committed to the repo anyone can debug and fix this (at least for the .NET Core build of WPF)

@nathankawalec
Copy link

I understand, thanks for the info :)
I'll be monitoring the repo -- once the render engine gets committed I'll be more than happy to debug this.

@fabiant3-zz fabiant3-zz added the Bug Product bug (most likely) label Sep 17, 2019
@fabiant3-zz fabiant3-zz added this to the Future milestone Sep 17, 2019
@Krudonix
Copy link

Hi,

Is there any update or work around on this ? We are getting hit pretty hard.

I tried the above on net8 will same issue.

Regards,

@Kuldeep-MS
Copy link
Member

Hi @Krudonix,

We weren't able to look at the issue yet. But will take a look at it soon.

Meanwhile if you can share any details, which is not already shared on the thread, that will be helpful for us to kick start our investigation.

@ashish-chawda
Copy link

ashish-chawda commented Jun 20, 2024

Hi,

Is there any update or work around on this ? We are getting hit pretty hard.

I tried the above on net8 will same issue.

Regards,

HI All, I am attaching a sample app where the issue is easily replicated, please use attached text file for the paste contents.
TextForPasting.txt
RTESpellCheckIssue.zip

Its uploaded here as well - https://github.com/ashish-chawda/RTERenderingIssue/tree/main/RTESpellCheckIssue

After pasting the text, you can see some lines are invisible or distorted.

@miloush
Copy link
Contributor

miloush commented Jun 20, 2024

Doesn't look like I can reproduce the issue on .NET 8, 125% DPI:
image

Can you share a screenshot?

@ashish-chawda
Copy link

Doesn't look like I can reproduce the issue on .NET 8, 125% DPI: image

Can you share a screenshot?

image

@ashish-chawda
Copy link

Any update on above please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Product bug (most likely)
Projects
None yet
Development

No branches or pull requests

8 participants