Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ehhh.... I think some of the current answers are missing something: what happens with exceptions?</p> <p>The only reason you would call <code>Wait</code> in a continuation would be to observe a potential exception from the antecedent in the continuation itself. The same observation would happen if you accessed <code>Result</code> in the case of a <code>Task&lt;T&gt;</code> and also if you manually accessed the <code>Exception</code> property. Frankly, I wouldn't call <code>Wait</code> or access <code>Result</code> because if there is an exception you'll pay the price of re-raising it which is unnecessary overhead. Instead you can just check the <code>IsFaulted</code> property off the antecedent <code>Task</code>. Alternatively you can create forked workflows by chaining on multiple sibling continuations that only fire based on either success or failure with <code>TaskContinuationOptions.OnlyOnRanToCompletion</code> and <code>TaskContinuationOptions.OnlyOnFaulted</code>.</p> <p>Now, it's not necessary to observe the exception of the antecedent in the continuation, but you may not want your workflow to move forward if, say, "Step 1" failed. In that case: specifying <code>TaskContinuationOptions.NotOnFaulted</code> to your <code>ContinueWith</code> calls would prevent the continuation logic from ever even firing. </p> <p>Keep in mind that, if your own continuations don't observe the exception, the person who is waiting on this overall workflow to complete is going to be the one to observe it. Either they're <code>Wait</code>ing on the <code>Task</code> upstream or have tacked on their own continuation to know when it is complete. If it is the latter, their continuation would need to use the aforementioned observation logic.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload