Visual caret bug after re-log in Windows

Hello,
we noticed a visual bug with with the caret when we work on remote desktop, if we close the session with an editor opened and then we start the remote desktop again, we notice a little change at the font size or font family of the editor, but the worst thing is that the caret is wrong visualy placed. Once it happens the only solution is to close the application and start it again.

We could also reproduce it without RDP changing Windows user and returning to the initial Windows user.

We noticed this bug some versions before(I think v4, but maybe is happening since we started using the editor…).

I’ve prepared a simple sample project using v7.1 where you can reproduce the bug. Also here is a video where you can see exactly what I am talking about.

Sample project: https://we.tl/t-zms7elwqgZ
Video: 2021-07-16_09-16-33

Regards,
Sergio.

Hi Sergio,

Thank you for reporting this issue, we will try to reproduce it, and will get back to you as soon as we find out what’s happening.

Regards,
Dmitry

Hi Sergio,

It looks like in this scenario default font is set upon RDP session is reconnected, causing these visual effects. We have fixed it internally, for now you can use the following workaround by deriving your own class from TextEditor and using it in your application,

public class Edit : TextEditor
{
    public Edit()
    {
        FontFamilyProperty.AddOwner(typeof(Edit), new FrameworkPropertyMetadata { Inherits = false });
    }
}

Let me know if it helps,
Dmitry

1 Like

Hi Dmitry,
I tested your solution on the project I created for this purpose and your solution seems to work fine, we will do this change in our main solution and will type you with the result.
On the other hand, about the workaround, won’t you do this kind of things in the static type initializer rather than in the constructor? I tried to put this code in the type initializer, but the error apears since begining without the need of reconnect the RDP session. Will it be any problems if we have more than one editor in the same window?

Thanks,
Sergio.

Well, as I suppossed, the workaround give us a “System.ArgumentException: ‘FontFamily’ was already registered by ‘Editor’”.