Asynchronous method call never fires when running under the debugger.
Messages   Related Types
This message was discovered on microsoft.public.vsnet.debugging.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

bill
I'm having trouble running the following code under the debugger (although it works correctly when it runs normally). The code calls a simple "Hello World" web service asynchronously and prints "Hello World" to the screen. My problem is that when I run it under the debugger the HelloWorldCallback method never fires. Can anyone tell me why?

Bill

using System;

namespace WebServiceDebugTest
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {

            localhost.Service1 webService = new WebServiceDebugTest.localhost.Service1();

            IAsyncResult ar = webService.BeginHelloWorld(new AsyncCallback(HelloWorldCallback),webService);
            
            Console.WriteLine("Push any key to quit ...\n");
            Console.ReadLine();
        
        }

        private static void HelloWorldCallback(IAsyncResult ar)
        {
            localhost.Service1 webService = ar.AsyncState as localhost.Service1;
            string result = webService.EndHelloWorld(ar);
Console.WriteLine("{0}\n",result);
        }
    }
}

Reply to this message...
 
    
Gregg Miskelly (VIP)
The problem is that you are blocking the main STA Thread without pumping
messages. Remove the '[STAThread]' attribute, or pump messages, and you
should be good.

--
Gregg Miskelly
http://blogs.msdn.com/greggm

This posting is provided "AS IS", with no warranties, and confers no rights.
"bill" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> I'm having trouble running the following code under the debugger (although
it works correctly when it runs normally). The code calls a simple "Hello
World" web service asynchronously and prints "Hello World" to the screen.
My problem is that when I run it under the debugger the HelloWorldCallback
method never fires. Can anyone tell me why?
[Original message clipped]

Reply to this message...
 
 
System.AsyncCallback
System.Console
System.IAsyncResult




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com