Visual Studio and .NET Framework Home
Windows Forms Designer CodeGen issue with SplitContainer
10/15/2008 10:21:06 AM
User(s) can reproduce this bug
The designer-generated code for a SplitContainer may order the property assignments incorrectly, resulting in a failure to execute the code (An InvalidOperationException is thrown on component initialization).
Visual Studio 2008 Service Pack 1
Operating System Language
Steps to Reproduce
Create a new windows forms application.
Enlarge the default form (I changed the size to (753, 494)).
Drag a SplitContainer to the Form. It should automatically Dock.Fill.
In the properties, change splitContainer1.Panel1MinSize to 222.
In the properties, change splitContainer1.Panel2MinSize to 320.
Save, build, and debug the program.
This appears to be closely related to, or perhaps a regression of, Bug ID 115466 on the Connect site (https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=115466)
System.InvalidOperationException was unhandled
Message="SplitterDistance must be between Panel1MinSize and Width - Panel2MinSize."
at System.Windows.Forms.SplitContainer.set_SplitterDistance(Int32 value)
at System.Windows.Forms.SplitContainer.set_Panel2MinSize(Int32 value)
at WindowsFormsApplication1.Form1.InitializeComponent() in C:\Users\Usgrdoo\Documents\Visual Studio 2005\Projects\NotifierConfiguration\NotifierConfiguration\WindowsFormsApplication1\Form1.Designer.cs:line 41
at WindowsFormsApplication1.Form1..ctor() in C:\Users\Usgrdoo\Documents\Visual Studio 2005\Projects\NotifierConfiguration\NotifierConfiguration\WindowsFormsApplication1\Form1.cs:line 16
at WindowsFormsApplication1.Program.Main() in C:\Users\Usgrdoo\Documents\Visual Studio 2005\Projects\NotifierConfiguration\NotifierConfiguration\WindowsFormsApplication1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
This is apparently thrown because Panel1MinSize and Panel2MinSize are set before Size is set.
The simple forms app runs and displays a split container with the specified min size properties.
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 6/30/2009 at 6:23 AM
Thanks for addressing this. :)
on 3/25/2009 at 10:15 PM
Thanks for your feedback on the .NET Framework!
We are able to reproduce the bug that you reported and consider rolling in a fix to this issue in next release if resources/schedule allow us.
Many customers have found it useful to discuss issues like this in the forums (http://forums.microsoft.com/msdn/default.aspx?siteid=1) where Microsoft and other members of the community can suggest workarounds.
Please keep the feedback comming.
on 12/1/2008 at 6:27 AM
What does "Closed (External)" mean? This has been repro'd and is a problem that exists in Microsoft code, isn't it? Is this something that just isn't going to ever be fixed?
Be the ball Danny
on 11/12/2008 at 3:44 PM
Whoa this is a long-standing issue! I found posts about it going way back to March 2006 that acknowledge this as a bug! It is now Nov 2008!
This also seems like it would be a simple fix.
C'mon folks, this doesn't do a lot for the credibility of your products eg. Visual Studio and .NET frameworks, your Engineering practices, eg. Microsoft has the most resources of any software company in the world and this simple bug is not fixed for at least 2.5 years! and overall this reflects badly on Microsoft as a whole.
How many person hours to fix this bug? 1 day? 1 week? I reckon one person working a week on this is worth it. Put someone on it. Hire me if you must!
on 10/27/2008 at 10:08 PM
Thanks for reporting the issue.
We are able to reproduce this issue in our environment.
Given the tight schedule/resources the team has for the next milestone of Visual Studio 2010, we'll look into this issue in more details later on. Shall update you when there is progress. Thank you for your patience.
on 10/22/2008 at 3:04 AM
Thanks for your feedback. We are escalating this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.
Visual Studio Product Team
to post a workaround.
Please enter a workaround.
on 10/15/2008 at 10:25 AM
The assignment of splitContainer.Panel2MinSize can be delayed and manually placed in the constructor after InitializeComponent. This is a maintenance burden, however. There is a significant advantage to maintaining all of these layout-related properties in the designer's property list.
© 2014 Microsoft