You are absolutely right.
InvokeRequired
is only needed in methods which is called sometimes from the UI thread (and then invocation is never needed) and sometimes from some non-UI thread (no matter which). The more usual case is when you create some method only to be called from a non-UI thread. In this case, there is no need to check the predicate function
InvokeRequired
— it is always required. You will save some CPU time.
I explained in detail how invocation works in WPF and Forms in my past answers:
Control.Invoke() vs. Control.BeginInvoke()[
^],
Problem with Treeview Scanner And MD5[
^].
As I was able to see, not everyone understands that without a UI thread this mechanism effectively does not work. Formally, invocation does not fail, but the behavior becomes trivial: the call is simply performed in the calling thread. :-(.
What to do in this case? For example, one can create a similar mechanism. Actually, I provided such code at CodeProject with detailed explanation and usage sample. In particular, you can queue delegate instances and use them in other thread. Please see my Tips & Trick article:
Simple Blocking Queue for Thread Communication and Inter-thread Invocation[
^].
—SA