Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze of designer when changing the control size when control happens to have a readonly array of structs property #12660

Closed
CortiWins opened this issue Dec 19, 2024 · 6 comments
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues

Comments

@CortiWins
Copy link

Environment

Microsoft Visual Studio Professional 2022
Version 17.12.3
VisualStudio.17.Release/17.12.3+35527.113
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Professional

C# Tools 4.12.0-3.24572.7+dfa7fc6bdea31a858a402168384192b633c811fa
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

.NET version

Net 8.0 Windows

Did this work in a previous version of Visual Studio and/or previous .NET release?

Did not check.

Issue description

I made a user control with a public readonly property of type array of structs.

When i try to change the controls size, visual studio and the out of process designer freeze while both staying at roughly 5% CPU use according to task manager.

[Browsable(false)] does not prevent it.

I reproduced the issue in a minimal project.

No immediate help required because i can just not do that. Have a good day everyone.

Steps to reproduce

  1. Create new Winforms 8.0 App
  2. Use this code
  3. Change the size in the designer
public partial class MrFreeze : UserControl
{
    public MrFreeze()
    {
        InitializeComponent();
    }

    public TestStruct[] StructArray { get; } = new TestStruct[5000];
}

public struct TestStruct
{
    public int a;
    public string b;
}

Diagnostics


@CortiWins CortiWins added the untriaged The team needs to look at this issue in the next triage label Dec 19, 2024
@elachlan
Copy link
Contributor

@Olina-Zhang can your team please have a look? I think there is some guidance on implementing custom controls and serialization that might help here.

@MelonWang1
Copy link
Contributor

@CortiWins Thank you for your feedback on the issue, but unfortunately we did not reproduce the issue based on the steps you provided. Below are the steps we took to reproduce the issue, can you check them?

12660.mp4

@elachlan
Copy link
Contributor

@MelonWang1 can you place the user control on a form and try resizing it? Maybe its that?

@MelonWang1
Copy link
Contributor

MelonWang1 commented Dec 20, 2024

@elachlan Yes, you are right. This issue cannot repro in .NET Framework project. Repro in VS16.11.42.

Repro step:

  1. Create a new Winforms .NET Core App
  2. Use Ctrl+Shift +A to add a UserControl
  3. Add below code
public partial class MrFreeze : UserControl
{
    public MrFreeze()
    {
        InitializeComponent();
    }

    public TestStruct[] StructArray { get; } = new TestStruct[5000];
}

public struct TestStruct
{
    public int a;
    public string b;
}
  1. Build project
  2. Drag the UserControl1 to form1 designer and resize it
12660.mp4

@Tanya-Solyanik
Copy link
Member

@MelonWang1 - could you please copy this issue to the designer repo if we don't already have one like this.

@Tanya-Solyanik Tanya-Solyanik added the area-VSDesigner Windows Forms out-of-proc designer related issues label Dec 20, 2024
@MelonWang1
Copy link
Contributor

Filed it in our internal designer repo: https://github.com/microsoft/winforms-designer/issues/6226 to track, closing this one.

@dotnet-policy-service dotnet-policy-service bot removed the untriaged The team needs to look at this issue in the next triage label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues
Projects
None yet
Development

No branches or pull requests

4 participants