Can SynchronizationContext.Post or .Send lead to exceptions?
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.InvokeRequired to be sure I am on the correct thread.
开发者_StackOverflowDo I still need to do that when using SynchronizationContext? In other words, can I always do a .Post() or .Send() even if I'm already on the correct thread?
Using Post or Send if you're already on the correct thread is not necessary, but it will work
精彩评论