Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Async WCF and InvokeRequired

 
 
Old 03-04-2006   #1 (permalink)
Steve Drake


 
 

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


 
 

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)
Juval Lowy


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
RAS ASYNC Adapter? Network & Sharing
Design for async call .NET General
is it possible to create async processes? PowerShell


Vista Forums 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 Ltd

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