FIX: Cannot step into a managed extensions for C++ WebMethod by using the Visual Studio .NET debugger (318617)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual C++ .NET (2002)

This article was previously published under Q318617

SYMPTOMS

When you debug a Managed Extensions for C++ Web Service WebMethod from a client application, you may not be able to step into the WebMethod (also called Causality Stepping). The debugger may step over the WebMethod.

CAUSE

This behavior occurs when the WebMethod contains certain types as parameters (for example, String *, __int64[]).

RESOLUTION

Place a breakpoint inside the WebMethod.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Microsoft Visual C++ .NET 2003 and in Microsoft Visual Studio .NET 2003.

MORE INFORMATION

Steps to Reproduce Behavior

To reproduce the problem, follow these steps:
  1. On a computer that has Internet Information Service (IIS) installed, create a Managed Extensions for C++ Web Service project named TestSvc.
  2. Open TestSvc.h, and then add the following WebMethod:
            [System::Web::Services::WebMethod] 
            String __gc* HelloWorld2(String* str);
    					
  3. Open TestSvc.cpp, and then add the following sample code:
        String __gc* Class1::HelloWorld2(String* str)
        {
    
    		// TODO: Add the implementation of your Web Service here.
    
    		return String::Concat(S"Hello ", str, "!");
            
        }
    					
  4. Compile the project, which also deploys the Web Service.
  5. Add a new C# Console Application project named TestSvcClient to the solution.
  6. Right-click TestSvcClient in Solution Explorer, and then click Set as StartUp Project.
  7. Right-click TestSvcClient in Solution Explorer, and then click Add Web Reference.
  8. In the Add Web Reference Address dialog box, type the appropriate URL for the Web Service that you created in the previous steps, for example http://localhost/TestSvc/TestSvc.asmx. Click Add Reference.

    NOTE: You may receive error messages when you use the .vsdisco file to discover the Web Service because the .vsdisco handler entry under httpHandlers is not enabled in \Windows\Microsoft.Net\Framework\v1.0.XXXX\CONFIG\Machine.config, by default. To prevent this, remove the remark notations (<!-- and -->) from the following statement:
    <!--<add verb="*" path="*.vsdisco"
           type="System.Web.Services.Discovery.DiscoveryRequestHandler,
           System.Web.Services, Version=1.0.YYYY.0, Culture=neutral,
           PublicKeyToken=zzzzzzzzzzzzzzz" validate="false"/>-->
    					
  9. Open Class1.cs, and then add the following lines of code to the Main function:
    TestSvcClient.localhost.Class1 Svc = new TestSvcClient.localhost.Class1();
    
    Console.WriteLine(Svc.HelloWorld());			// BreakPoint 1.
    Console.WriteLine(Svc.HelloWorld2("World 2"));	// BreakPoint 2.
    					
  10. Keep a breakpoint in each of the Console.WriteLine statements.
  11. Press F5 to start the debugger, and then break at the first breakpoint.
  12. Press F11 to step into the Managed Extensions for C++ WebMethod.

    NOTE: You must add the account under which the ASP.NET worker process runs to the Debugger Users group on the server to run Causality Stepping (step into a WebService method from a Web Service client) in the Debugger. By default, the account is named ASPNET. If you have changed the identity of the user that you use for this purpose, add the appropriate user to the Debugger Users group.
  13. Press F5. The debugger stops at the second breakpoint.
  14. Press F11. Typically, the debugger steps over the HelloWorld2 call, and then places the insertion point at the end of the Main function. However, if you keep a breakpoint inside the WebMethod, the debugger stops at that breakpoint.

REFERENCES

For more information about Debugger and Debugger settings and preparation, refer to the following articles in the Microsoft Developer Network (MSDN) Documentation:

Modification Type:MajorLast Reviewed:7/29/2005
Keywords:kbvs2002sp1sweep kbfix kbBug kbDebug kbManaged kbpending KB318617