ynchronizationontext

SynchronizationContext.Post(...) in transport event handler

We have a method which, due to threading in the client application requires the usage of SynchronizationContext. There is a bit of code which one of my colleagues has written which doesnt "feel" right to me, and a performance profiler is telling me that quit a lot of processing is being used in this bit of code. void transportHelper_Su...

C# Thread in Thread: how to get SynchronizationContext.Current ?

I have a WindowsForms application wich has SynchronizationContext.Current not null But from that WindowsForms app I create a new Thread called thread1 From thread1 I create another Thread called thread2 When I try to POST methods from thread2 in thread1 using SynchronizationContext.Current, will fail because SynchronizationContext.Curren...

Why is SynchronizationContext.Current null in my Winforms application?

I just wrote this code: System.Threading.SynchronizationContext.Current.Post( state => DoUpdateInUIThread((Abc)state), abc); but System.Threading.SynchronizationContext.Current is null ...

Can SynchronizationContext.Post or .Send lead to exceptions?

Hi I've read all recommended articles on SynchronizationContext, but there is one small question I did not find an answer for. In my case I have an event handler that calls a Log() method that outputs text to a TextBox. Log() is called from a WCF service. The event is raised from WCF client instances (threads). Usually, I check Control.I...

Dispatcher and SynchronizationContext classes

Can somebody tell me when to use a Dispatcher and when to use the SynchronizationContext class. For a while now I had been using the Dispatcher to queue up tasks from a background thread then I discovered the SynchronizationContext. ...

Could SynchronizationContext be used not in WinForms/WPF application?

I'm writing a component that would be used in WinForms or WPF applications also could be used in Windows services or Unit tests. Is there a way to use SynchronizationContext component in non UI apps? ...