Microsoft KB Archive/316554

= BUG: Creating circular references between UserControls closes Visual Basic .NET without a warning =

Article ID: 316554

Article Last Modified on 8/18/2005

-

APPLIES TO


 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-



This article was previously published under Q316554



SYMPTOMS
When you use Visual Basic .NET to create two Windows Control Libraries (UserControls) that have a circular reference between them, and then you try to add one control onto another, the integrated development environment (IDE) may close (crash) without warning.



CAUSE
The stack overflow exception is not properly trapped.



RESOLUTION
To work around this problem, do not use circular references between the UserControls.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Start a new Windows Control Library project using Visual Basic .NET. UserControl1 is created by default. On the Project menu, click Add User Control, and then add UserControl2 to the project. Double-click the UserControl1 designer to view the code.  Above the UserControl1_Load sub, type the Dim u as New UserControl2 statement so that the code resembles the following: Dim u As New UserControl2 Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub   Repeat steps 3 and 4 for UserControl2 so that the code resembles the following: Dim u As New UserControl1 Private Sub UserControl2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub </li> On the Build menu, click Build Solution.</li> In the Toolbox on the designer for UserControl1, double-click UserControl2 to add it to UserControl1.</li></ol>

When you perform the same steps in Visual C#, you experience slightly different behavior. The IDE does not close immediately. The Just-In-Time (JIT) debugger starts with the following error message:

An exception 'System.StackOverflowException' has occurred in DefaultDomain.

If you click No to dismiss the JIT dialog box, then the IDE closes without warning.

Additional query words: usercontrol ide jit circular reference

Keywords: kbbug kbpending kbvs2002sp1sweep KB316554

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.