Bloated Designer.cs file


Author
Message
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Hi guys,



This is a general observation rather than a specific SF problem.



I noticed by total accident that the designer.cs file for a relatively large form contained references to comboboxes that were no-longer displayed on the form and which I thought had long since been deleted. The form had 15 SF comboboxes but the designer file created, initialized and databound 27 comboboxes - the other 12 were never shown or used and were totally hidden. During early form development I have no doubt I added and removed the other 12 comboboxes but their references remained within the designer file for some reason. Since removing the 12 "ghost" comboboxes from the designer file, the form loads faster - dramatically so in the form designer which always stalled for 20 seconds on loading after clicking on the first field. The problem isn't only restricted to the combobox as there are numerous labels as well.



It appears Visual Studio is not very good at cleaning up the designer file. If you have a reasonably complex form which has undergone editing over a period of time, it would be worth checking the designer file if you are experiencing slow loading and stalling in the form designer.



I am off to try and find a utility which will scan the designer file and report on un-used objects. Smile



Aaron



Russell Scott Brown
Russell Scott Brown
StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)StrataFrame User (278 reputation)
Group: Forum Members
Posts: 124, Visits: 597
Thanks for pointing this out.  I would never have thought to look for this type of thing happening.

Hope you find a good utility to do this.

Russ Brown (Using C#2010/SQL Server 2008)

Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Just as a follow-up, the final count of "ghost" controls in this form is:-



Combobox x 12

Checkbox x 3

Date time picker x 4

Label x 33

NumericUpDown x 1

Textbox x 21

ThemedGroupBox x 5



All of these controls appeared in the designer.cs with settings that should have made the controls visible and positioned correctly on the form to have been seen - yet none were visible in the designer or at runtime. None of these controls appeared in the document outline yet they were listed in the properties window.



I don't know how this happened but the designer.cs file is now much smaller after they have been removed and it loads faster Smile



I have started checking other forms and the next one in the sequence has similar problems so it doesn't look like a one off.



Aaron
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I have seen this once or twice, and we have some massive forms, but generally this happens under some relatively stricti and strange conditions. Like I said, I saw this once before a while back and haven't seen it since. I think it had to do with the assembly being loaded into the AppDomain and not being dumped when run (F5) through VS while the designer is open. To prevent this, I think that if you totally close the designer and run this is less likely to happen.
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Ah that could explain it. I have a habit of keeping the designer open when I hit F5.



Thanks for the info - will try it and keep a lookout.



Aaron
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search