Skip to content

In Designer, Nesting a TreeView in a UserControl in a second TabPage on a Form hangs DesignServerTools.exe #4336

Closed

Description

@The-MAZZTer

Apologies if this is not the right repo to post this in.

[Edit: I found instruction to send feedback using the VS Feedback tool in Visual Studio and I have done so, please close this issue here if it is not appropriate for this repo.]

  • .NET Core Version:
    Microsoft.NETCore.App 5.0.0
    Microsoft.WindowsDesktop.App 5.0.0
    SDK 5.0.100
    Visual Studio Community Version 16.8.2

  • Have you experienced this same bug with .NET Framework?:
    No

Problem description:
In the designer, upon activating a second tab page containing a User Control with a TreeView in it, VS hangs.

Expected behavior:
Visual Studio does not hang and the designer continues to work normally.

Minimal repro:
SetFocusBug.zip

This project was created with the following steps:

  • Create a Windows Form App (.NET) project.
  • Open Form1 in the designer.
  • Add a TabControl and keep the two tabs.
  • Add a User Control to the project. Open it in design mode.
  • Add a TreeView to the User Control and build the project to compile it.
  • Add the User Control to the second TabPage on the Form.
  • Save form.
  • Switch to the first TabPage and then back to the second and the hang should occur.
  • Upon recovering, simply reopen the form and switch to the second TabPage to cause the hang again (assuming the save went through).

If using the attached project, build before opening the form (hang does not happen until build is made and designer reopened).

You may also need to rebuild in that VS session, or with the designer open. I am seeing inconsistent behavior where the designer does not show the User Control at all after I open the project in a fresh session of VS.

These variants of the project do NOT produce any hangs or other undesirable behavior:

  • UserControl does not contain TreeView
  • TreeView directly on TabPage without user control
  • UserControl with TreeView on first TabPage (at least, having it visible when the form loads does not hang)

I attempted to debug both VS and DesignServerTools but I am not sure exactly what I am looking at.

VS' UI thread seems to hang waiting for a response from the DesignServerTools for a Hit Test on the designer or a control or something.

One of the DesignServerTools threads that stuck out to me seems to get struck calling the native SetFocus WinAPI whenever I happened to pause it. It seems to call it but the call never completes if I try to step over it.

Killing the DesignServerTools process tends to allow VS to recover so I believe the problem lies with DesignServerTools.

Activity

  1. changed the title [-]Nesting a TreeView in a UserControl in a second TabPage on a Form hangs DesignServerTools.exe[/-] [+]In Designer, Nesting a TreeView in a UserControl in a second TabPage on a Form hangs DesignServerTools.exe[/+] on Dec 8, 2020
  2. Zheng-Li01 commented on Dec 8, 2020

    @Zheng-Li01
    Member

    Failed to repro the issue following the steps based on The-MAZZTer's description, however reproduce the issue after click "Add Tab"/"Remove Tab". see below repro GIF.
    UpdateCoreIssue
    in addition, there have a similar known 2632 issue in Design repo to track it.

  3. The-MAZZTer commented on Dec 8, 2020

    @The-MAZZTer
    Author

    On my Developer Community thread a similar known issue was posted. I reproduced and debugged it and it appears very similar to what I am seeing in my issue, so it is likely the same problem.

    https://developercommunity2.visualstudio.com/t/Nesting-a-TreeView-in-a-UserControl-in-a/1280521

  4. RussKie commented on Dec 8, 2020

    @RussKie
    Contributor

    Thank you. The issue is being tracked in the designer repo, and it is expected to be fixed in 16.9.

  5. added
    area-VSDesigner
    on Dec 8, 2020
  6. added this to the VS release milestone on Dec 8, 2020
  7. RussKie commented on Feb 21, 2022

    @RussKie
    Contributor

    @Zheng-Li01 can you please if this still repros? If not - please close.

  8. added
    waiting-for-testing
    on Feb 21, 2022
  9. removed
    waiting-for-testing
    on Apr 7, 2022
  10. Cassie-Li01 commented on Apr 7, 2022

    @Cassie-Li01

    The issue can repro on version 17.2.0 Preview 2.1 download from: https://visualstudio.microsoft.com/vs/preview/

    repro steps:

    1. Create a Windows Form App (.NET) project.
    2. Open Form1 in the designer.
    3. Add a TabControl and keep the two tabs.
    4. Add a User Control to the project. Open it in design mode.
    5. Add a TreeView to the User Control and build the project to compile it.
    6. Add the User Control to the second TabPage on the Form.
    7. Save form.
    8. Switch to the first TabPage and then back to the second and the hang should occur.
      still repro

    in addition, there is a similar known issue https://github.com/dotnet/winforms-designer/issues/2632 in Design repo to track it.

  11. JeremyKuhne commented on Apr 19, 2023

    @JeremyKuhne
    Member

    Note that #9002 may be the same root issue

  12. Tanya-Solyanik commented on Oct 25, 2024

    @Tanya-Solyanik
    Contributor

    This is a duplicate of https://github.com/microsoft/winforms-designer/issues/2632, closing, we'll update this issue when we make progress on the internal issue.

  13. locked and limited conversation to collaborators on Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-VSDesignertracking

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions