Microsoft KB Archive/318617

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

Article ID: 318617

Article Last Modified on 7/29/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-



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.



Steps to Reproduce Behavior
To reproduce the problem, follow these steps:  On a computer that has Internet Information Service (IIS) installed, create a Managed Extensions for C++ Web Service project named TestSvc.  Open TestSvc.h, and then add the following WebMethod: [System::Web::Services::WebMethod] String __gc* HelloWorld2(String* str);   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&quot;Hello &quot;, str, &quot;!&quot;); }                    Compile the project, which also deploys the Web Service. Add a new C# Console Application project named TestSvcClient to the solution.</li> Right-click TestSvcClient in Solution Explorer, and then click Set as StartUp Project.</li> Right-click TestSvcClient in Solution Explorer, and then click Add Web Reference.</li>  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 from the following statement: </li>  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(&quot;World 2&quot;)); // BreakPoint 2. </li> Keep a breakpoint in each of the Console.WriteLine statements.</li> Press F5 to start the debugger, and then break at the first breakpoint.</li> 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.</li> Press F5. The debugger stops at the second breakpoint.</li> 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.</li></ol>

<div class="references_section">