question

CommanderLake-8431 avatar image
0 Votes"
CommanderLake-8431 asked AgaveJoe commented

Winforms slows windows entirely after manipulating form controls

If I create a form with several controls and manipulate or resize components or the form, windows itself will gradually get less responsive the more I manipulate the form and moving windows around the screen will get slower the more I manipulate the form to the point I try moving any window or even just the mouse not just the application I created and things just crawl across the screen and everything becomes almost unusable.
This is NOT caused by any code in the application, it does NOT use the CPU excessively, if the application is at a breakpoint or even if the process is suspended it will do the same thing.
The number of controls in the application seems to have an effect on the gradual decrease in responsiveness of the entire operating system but performance is normal then the application is first opened and returns to normal when closed.

dotnet-csharpwindows-forms
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

So what code do you have that's manipulating the controls/components?
Presumably something you're doing is causing a resource leak that's giving rise to the issue you're experiencing.
Start by chopping out your code to establish it is (or isn't) the cause of the problem.

1 Vote 1 ·

Try reading the op again, all other programs lag even when the process is suspended or being debugged and at a breakpoint, I am manipulating the window manually.

0 Votes 0 ·

Presumably because your application has taken a load of resources.
If your program never runs, do you get a problem?

0 Votes 0 ·

Can you create a GitHub repository, place your Visual Studio solution into the repository then come back with a link to the repository. This way those who are willing to assist can get the full picture.

it does NOT use the CPU excessively

Use Visual Studio's memory profiler to examine memory usage

The number of controls in the application seems to have an effect on the gradual decrease in responsiveness

This may be a memory leak or you are not disposing of objects either because they are scoped incorrectly or never disposed.

then the application is first opened and returns to normal when closed

Another sign of memory issues




0 Votes 0 ·

AGAIN I am manipulating the form manually, with my mouse, NO CODE is involved and the same thing happens when the process is suspended (not running) but still open and again it stops when its terminated, It affects ALL other programs not just my one. There is no abnormal memory usage. PLEASE READ thoroughly so I don't have to keep repeating myself. you can just make a form yourself with a bunch of controls and drag a corner of the form in circles till it gets laggy.

0 Votes 0 ·
AgaveJoe avatar image AgaveJoe CommanderLake-8431 ·

I cannot reproduce this issue.

Create a Windows Forms application using Visual Studio 2022 and .NET 6.
Add 74 controls to the form
Open task manager
In the Visual Studio designer, drag a corner of the form in circles for 1 minute No impact to system resources.
Start the application using the debugger and drag a corner of the form in circles for 1 minute No impact to system resources.
Start without the debugger and drag a corner of the form in circles for 1 minute No impact to system resources.

there must be something you are no telling us. Please share your application on Github so the community is not forced to guess.

1 Vote 1 ·
JackJJun-MSFT avatar image JackJJun-MSFT CommanderLake-8431 ·

@CommanderLake-8431,are you using visual stduio 2022? If so, Could you provide the specific version? Is your winform app .net core or .net framework app?

0 Votes 0 ·

0 Answers