question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RichTextBox insert text application will crash

See original GitHub issue
  • .NET Core Version: netcoreapp 3.1
  • Windows version: Windows 10 CMGE
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc…)? No.
  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

Problem description: the problem occur when we set the caret on the BlockUIContainer and typing any character,that will raise FatalExecutionEngineError in framework 4.7.2 or raise ExecutionEngineException in netcore 3.1.

How to reproduce?

  1. create an wpf project,and add this xaml code to mainwindow.xaml
<RichTextBox>
            <FlowDocument>
                <BlockUIContainer>
                    <Image Source="D:\sample.jpg"/>
                </BlockUIContainer>
            </FlowDocument>
        </RichTextBox>
  1. use an image file to instead D:\sample.jpg
  2. run app
    4.click image and press Arrow-Right
    5.type any character

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:21
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
miloushcommented, Jan 12, 2023

Basically I think it is illegal to add a paragraph during SetText since TSF has a lock on the store. Citing the documentation:

Applications must never modify the document or send change notifications using the ITextStoreACPSink::OnTextChange method from within the ITextStoreACP::RequestLock method.

For the first option, if the _netCharCount is updated with the correct value in SetText, the crash is fixed (by definition) and the IME works uninterrupted, but I believe we should technically inform the sink that a paragraph has been added once the lock is lifted. This is a bit tricky because we need to track where the paragraph insertion ends up being after the composition.

1reaction
Luoyingliangcommented, Oct 14, 2020

we test in another device,this problem reproduce again

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# program crashes when adding a Paragraph from ...
I am trying to add a Paragraph to a RichTextBox control from another thread and my app crashes as soon as I try...
Read more >
RichTextBox crashes on character input with IME ...
Hello, Typing characters with switching IME input mode will crash your RichTextBox sample application. In 2017.2.614 the process is killed and ...
Read more >
WPF RichTextBox misses key strokes when spell check ...
After the windows update KB4562900. When the spell check finds a misspelled word the rich text box misses key strokes. Only happens with...
Read more >
simulation causes bug : System Access Violation
I've made a 'Crash Test' app that demonstrates the problem which can be downloaded from my GoogleDrive and was written in MS C#2019...
Read more >
EXTENDED Version of Extended Rich Text Box ...
NET 4.7 or later, cause the app to crash when one selects multiple words in the rich-text box, then uses the toolstrip combo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found