Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Async WCF and InvokeRequired

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 03-04-2006   #1 (permalink)
Steve Drake
Guest


 

Async WCF and InvokeRequired

All,

I have a smart client that talks to an WCF service, all my calls are ASYNC,
I have noticed that InvokeRequired never gets sent to true.

When I look at the threads in the debugger, I can see that the async call
backs use the same thread as the form, is this always going to be the case?

Steve



My System SpecsSystem Spec
Old 03-04-2006   #2 (permalink)
Juval Lowy
Guest


 

Re: Async WCF and InvokeRequired

Steve,

Can you be a bit more specific on the scenario?

Thanks,

Juval Lowy.


"Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
news:eca1R9TFGHA.1676@TK2MSFTNGP09.phx.gbl...
> All,
>
> I have a smart client that talks to an WCF service, all my calls are
> ASYNC, I have noticed that InvokeRequired never gets sent to true.
>
> When I look at the threads in the debugger, I can see that the async call
> backs use the same thread as the form, is this always going to be the
> case?
>
> Steve
>



My System SpecsSystem Spec
Old 03-04-2006   #3 (permalink)
Steve Drake
Guest


 

Re: Async WCF and InvokeRequired

This is not an issue eg is not causing me a problem.

I have a windows form application, I run a remote method asynchronously, eg

thing.BeginGetNodes(treeParent, new AsyncCallback(endAddNodes), new
statething(tn, treeParent));

In my endAddNodes I would expect me to need to todo code like :

if (InvokeRequired)
{
// Never gets called
this.BeginInvoke(new AsyncCallback(endAddNodes), new object[] { ar });
}

but, as InvokeRequired never gets set to true, i dont need this code, i have
check the Thread number in Debug, and the endAddNodes is getting called by
the correct thread, eg is the thread that is used to create the form.

So, my question is, is this by design and is it going to remain.

Steve





"Juval Lowy" <juval.lowy_remove_this@idesign.net> wrote in message
news:OP3qTOXFGHA.524@TK2MSFTNGP09.phx.gbl...
> Steve,
>
> Can you be a bit more specific on the scenario?
>
> Thanks,
>
> Juval Lowy.
>
>
> "Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
> news:eca1R9TFGHA.1676@TK2MSFTNGP09.phx.gbl...
>> All,
>>
>> I have a smart client that talks to an WCF service, all my calls are
>> ASYNC, I have noticed that InvokeRequired never gets sent to true.
>>
>> When I look at the threads in the debugger, I can see that the async call
>> backs use the same thread as the form, is this always going to be the
>> case?
>>
>> Steve
>>

>
>



My System SpecsSystem Spec
Old 03-04-2006   #4 (permalink)
Juval Lowy
Guest


 

Re: Async WCF and InvokeRequired

I assume you are using a proxy with



[OperationContract(AsyncPattern = true,.]



Yes, this is by design.

If Begin<operation name> is dispatched by a UI thread (actually, any thread
that has Windows Forms context), the callback will automatically be
marshaled to UI thread so that you could access windows and controls
directly.



A similar feature is available with ASMX proxies in .NET 2.0 without WCF, as
well as PictureBox.LoadAsync(), SoundPlayer, Ping.Send(), etc.



Hope that helps,



Juval Lowy.



"Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
news:eggCA7fFGHA.648@TK2MSFTNGP14.phx.gbl...
> This is not an issue eg is not causing me a problem.
>
> I have a windows form application, I run a remote method asynchronously,
> eg
>
> thing.BeginGetNodes(treeParent, new AsyncCallback(endAddNodes), new
> statething(tn, treeParent));
>
> In my endAddNodes I would expect me to need to todo code like :
>
> if (InvokeRequired)
> {
> // Never gets called
> this.BeginInvoke(new AsyncCallback(endAddNodes), new object[] { ar });
> }
>
> but, as InvokeRequired never gets set to true, i dont need this code, i
> have check the Thread number in Debug, and the endAddNodes is getting
> called by the correct thread, eg is the thread that is used to create the
> form.
>
> So, my question is, is this by design and is it going to remain.
>
> Steve
>
>
>
>
>
> "Juval Lowy" <juval.lowy_remove_this@idesign.net> wrote in message
> news:OP3qTOXFGHA.524@TK2MSFTNGP09.phx.gbl...
>> Steve,
>>
>> Can you be a bit more specific on the scenario?
>>
>> Thanks,
>>
>> Juval Lowy.
>>
>>
>> "Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
>> news:eca1R9TFGHA.1676@TK2MSFTNGP09.phx.gbl...
>>> All,
>>>
>>> I have a smart client that talks to an WCF service, all my calls are
>>> ASYNC, I have noticed that InvokeRequired never gets sent to true.
>>>
>>> When I look at the threads in the debugger, I can see that the async
>>> call backs use the same thread as the form, is this always going to be
>>> the case?
>>>
>>> Steve
>>>

>>
>>

>
>



My System SpecsSystem Spec
 
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Design for async call Fred .NET General 0 06-10-2008 03:56 AM
is it possible to create async processes? Frank PowerShell 5 04-16-2007 07:47 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51