Microsoft KB Archive/325118

= Visual Studio 2005 or Visual Studio .NET debugger does not step into the Load event =

Article ID: 325118

Article Last Modified on 12/11/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Express Edition
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Basic 2005
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# 2005 Express Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition
 * Microsoft Visual J# 2005 Express Edition
 * Microsoft Visual J# .NET 2003 Standard Edition
 * Microsoft Visual J# .NET 2003 Standard Edition

-



This article was previously published under Q325118



SYMPTOMS
In Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, when you click Step Into on the Debug menu or when you press F11 to start your Microsoft Windows-based application, the debugger does not step into any startup events in the form after the constructor is called. For example, the debugger does not step into the Form Load event.



CAUSE
This problem occurs because the code that is generated between the constructor and the Load event of the form does not have debugger symbols. When the debugger contacts the code that does not have the debugging symbols, it does not step.



WORKAROUND
To work around this issue, set a breakpoint in the event that you want to step through.



STATUS
This behavior is by design.



Steps to reproduce the issue
 In Visual Studio 2005 or in Visual Studio .NET, create a new Windows Application project by using one of the following:  Microsoft Visual Basic 2005 Microsoft Visual Basic .NET Microsoft Visual C# 2005 Microsoft Visual C# .NET</li> Microsoft Visual J# 2005</li> Microsoft Visual J# .NET</li></ul>

By default, Form1 is created.</li> In the designer view, double-click Form1 to open the Form Load event in the code view.</li> Add the following code to the Form Load event: <ul>  Visual Basic System.Diagnostics.Debug.WriteLine(&quot;Hello World!&quot;) </li>  Visual C# System.Diagnostics.Debug.WriteLine(&quot;Hello World!&quot;); </li>  Visual J# System.Diagnostics.Debug.WriteLine(&quot;Hello World!&quot;); </li></ul> </li> Press F11 or click Step Into on the Debug menu to start stepping into the code.</li> Continue to press F11 to step into the constructor of the Windows form.</li> After the constructor is executed, the form is displayed without going into the code in the Form Load event.</li> When you set a breakpoint in the Form Load event, then the execution stops at the breakpoint after it executes the constructor.

You can continue to step through the Form Load event from this breakpoint.</li></ol>

<div class="references_section">