You cannot jump to the source file if you press F4 when you are debugging in Visual C++ .NET or in Visual C++ 2005 (820993)



The information in this article applies to:

  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)

SYMPTOMS

You can write trace messages to the Output window for debugging purposes. In Visual C++ 6.0, when you press F4, you can jump immediately to the source line that generates the output message. However, if you press F4 in Visual C++ .NET or in Visual C++ 2005, the Property Pages window for the project appears.

CAUSE

In Visual C++ .NET or in Visual C++ 2005, key mappings are changed. The F4 key is mapped to the Open Property window in Visual C++ .NET or in Visual C++ 2005.

RESOLUTION

To resolve this problem, keep the Output window open, and then press F8 to iterate through all debug messages.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Visual Studio .NET or Visual Studio 2005.
  2. On the File menu, point to New, and then click Project.
  3. Click Visual C++ Projects under Project Types, and then click Win32 Project under Templates.

    Note In Visual Studio 2005, click Visual C++ under Project Types, and then click Win32 Project under Templates.
  4. Accept the default settings, and then click Finish.
  5. In the .cpp file, paste the following code in front of the declaration of the InitInstance function:
    #include <string>
    void Log(LPCTSTR sFile,unsigned int nLine)
    {
    	TCHAR str[50];
    	std::string sMsg=sFile;
    	wvsprintf(str,"(%u): error\n",(char*)&nLine);
    	sMsg+=str;
    	OutputDebugString(sMsg.c_str());
    }
    
  6. Paste the following code after the CreateWindow call in the InitInstance function:
    Log(__FILE__,__LINE__);
  7. Build the project, and then press F5 to run the application in Debug mode.
  8. Close the application.
  9. Verify that the Output window displays the debug output. The output appears similar to the following:

    <projectname.cpp with full path >(Line Number): error

    where projectname is the name of your .cpp project.
  10. Press F4. You may notice that the log line is not displayed.

Modification Type:MajorLast Reviewed:1/4/2006
Keywords:kbDebug kbprb kbIDEProject kbDevStudio KB820993 kbAudDeveloper kbAudITPRO