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

Article translations Article translations
Article ID: 325118 - View products that this article applies to.
This article was previously published under Q325118
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

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.

MORE INFORMATION

Steps to reproduce the issue

  1. 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
    • Microsoft Visual J# 2005
    • Microsoft Visual J# .NET
    By default, Form1 is created.
  2. In the designer view, double-click Form1 to open the Form Load event in the code view.
  3. Add the following code to the Form Load event:
    • Visual Basic
      System.Diagnostics.Debug.WriteLine("Hello World!")
    • Visual C#
      System.Diagnostics.Debug.WriteLine("Hello World!");
    • Visual J#
      System.Diagnostics.Debug.WriteLine("Hello World!");
  4. Press F11 or click Step Into on the Debug menu to start stepping into the code.
  5. Continue to press F11 to step into the constructor of the Windows form.
  6. After the constructor is executed, the form is displayed without going into the code in the Form Load event.
  7. 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.

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
317297 Roadmap for Debugging Hangs, Memory Leaks, Deadlocks, and Race Conditions in Visual Basic .NET

Properties

Article ID: 325118 - Last Review: February 27, 2014 - Revision: 5.9
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
Keywords: 
kbnosurvey kbarchive kbvs2005swept kbvs2005applies kbwindowsforms kbforms kbevent kbdebug kbprb KB325118

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com