Skip to content

WinForm RichTextBox LinkClicked event fails to fire when control loaded with RTF containing a friendly name hyperlink #1520

Closed

Description

@Marie-Shi
  • .NET Core Version: .Net Core 3.0.100-preview8-013587 build from master branch
  • Have you experienced this same bug with .NET Framework?: Yes

Problem description:

  1. Open attached app in VS and run it.
    RichTextBoxCoreApp.zip

  2. Click the “Click here”, then observe the behavior of browser.

Actual behavior:
There is no response after clicking the “Click here”.

Expected behavior:
WinForm RichTextBox LinkClicked event can be fired when control loaded with RTF containing a friendly name hyperlink after clicking the “Click here”.

Activity

  1. weltkante commented on Jul 29, 2019

    @weltkante
    Contributor

    Your title is wrong, the event does fire, your screenshot shows that you are running Process.Start and failing.

    You cannot use Process.Start(string) with URLs in .NET Core because the default of UseShellExecute changed to false to be consistent between platforms (it used to default to true in Desktop Framework). Since only Windows supports UseShellExecute (which is required for "executing" URLs) you now have to specify this explicitly. Just use an overload which allows to specify UseShellExecute.

    Also note that this isn't a WinForms issue, but a CoreFX issue (you linked one of them yousrelf), and the core issue it already has been discussed resolved as "by design" (can't find the main issue right now or I'd link it, sorry, but the corefx issue you linked yourself contains more discussion and issue links). Cross platform consistency has been deemed more important than backwards compatibility. This is not new for .NET Core 3 but has been a thing in the previews versions as well.

  2. merriemcgaw commented on Jul 29, 2019

    @merriemcgaw
    Contributor

    @ericstj , @karelz can you help us locate the corefx bug that @weltkante links. Can you confirm the failure in the process.start call is by design?

    @Marie-Shi - you should change the test as @weltkante suggests and confirm that it works.

  3. added this to the 3.1 milestone on Jul 29, 2019
  4. added
    🪲 bug
    waiting-author-feedback
    on Jul 29, 2019
  5. Marie-Shi commented on Jul 30, 2019

    @Marie-Shi
    Author

    @weltkante @merriemcgaw “More info” is another scenario when RichTextBox use Test2.rtf(just add more words than Test.rtf in attached project), click the “Click here”, it is blocked by GitHub issue 33714. But using Test2.rtf in .Net Framework project, click the “Click here”, it opens the browser and navigates to the page of Google. The original problem is in “Problem description”, using Test.rtf, there is no response after clicking the “Click here”.
    The title is consistent with the bug reproduce steps & Actual behavior.

  6. karelz commented on Jul 30, 2019

    @karelz
    Member

    UseShellExecute default changed as described above. If that is the root cause, all is fine and by design.
    cc @wtgodbe

  7. weltkante commented on Jul 30, 2019

    @weltkante
    Contributor

    @wtgodbe No thats about what UseShellExecute should do on Linux, though the title doesn't reflect that.

    The one I had in mind had a discussion about what the right thing to do was, from the three options

    • always throw an exception on Linux because UseShellExecute defaults to true but is not supported
    • have different behavior of the same API between Linux and Windows
    • change the behavior on Windows to be consistent on all platforms

    Option 3 was decided to be the one to go with (and I agree with that because the other two options make running the same code on different platform pretty much impossible). In hindsight it would probably have been a good idea to also obsolete the API or provide an Analyzer, to avoid the ongoing confusion. (We've done this for our own codebase to make it compatible with both Desktop and Core, with an Analyzer forcing everyone to go through a helper method with fixed semantics or specify UseShellExecute explicitely in the caller.)

    Small side note, UseShellExecute=true is not even supported among all Windows platforms anymore.

  8. removed
    waiting-author-feedback
    on Jul 31, 2019
  9. added
    💥 regression-preview
    and removed on Aug 20, 2019
  10. modified the milestones: 3.1, 3.0.0-GA on Aug 20, 2019
  11. added a commit that references this issue on Aug 20, 2019
    f91eb3b
  12. ghost added
    🚧 work in progress
    on Aug 20, 2019
  13. ghost removed
    🚧 work in progress
    on Aug 20, 2019
  14. Marie-Shi commented on Sep 10, 2019

    @Marie-Shi
    Author

    Verified this bug with .Net core 3.0.100-rc1-014190 from release branch, WinForm RichTextBox LinkClicked event can be fired when control loaded with RTF containing a friendly name hyperlink after clicking the “Click here”.

  15. ghost locked as resolved and limited conversation to collaborators on Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🪲 bug💥 regression-preview

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions