3

I'm building a chat app where I use several RichTextBlock for displaying chat messages.

Some of them contain one or more Hyperlink objects.

My problem is that when I click on one of these hyperlinks the app crashes with a Access Violation exception. This only happens if the input TextBoxof the chat has focus and the virtual keyboard is displayed on screen. When they keyboard is closed / focus of TextBox is cleared, it works without any problems.

I've found a similar issue here: Hyperlink in RichTextBlock makes the application crash on clicking

However, the accepted answer does not help me, because I can't use a HyperlinkButton instead of a Hyperlink. The hyperlinks can occur in between normal text and should handle line breaks and similar stuff.

Do you have any idea on how to solve this? So far, I've only found out, that this seems to be a common bug, but no solution on how to fix it.

EDIT: After tapping the link the app just closes and the console prints out

The program '[2296] app.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

The global handler for unhandled exceptions is also not called.

Community
  • 1
  • 1
Luke47
  • 31
  • 2
  • Please post the full stack trace of the exception. – dymanoid Nov 16 '16 at 14:10
  • Thanks, I've added it to my question. Unfortunately, it is not that much :/ – Luke47 Nov 16 '16 at 14:23
  • You have to debug your app or to use some kind of logger to get the exception stack trace. – dymanoid Nov 16 '16 at 14:28
  • I'm debugging it, but it won't break at the exception (all exception types enabled). I will do some further research on logging. – Luke47 Nov 16 '16 at 14:45
  • Can you please show the way you are dealing the rich textbox and hyperlink with `XAML`?? – Vishnu Babu Nov 17 '16 at 11:42
  • 1
    I use `Underline` instead of `Hyperlink` due to few reasons and process clicks by self. You can try the same, it's easy. Add attached property to `RichTextBlock` like 'ClickAction' and call it from `Click` event of `Hyperlink` block. – crea7or Nov 20 '16 at 21:21

0 Answers0