PrepAway - Latest Free Exam Questions & Answers

You need to ensure that the second operation is invoked…

You use the Task.Run() method to launch a long-running data processing operation. The data processing
operation often fails in times of heavy network congestion.
If the data processing operation fails, a second operation must clean up any results of the first operation.
You need to ensure that the second operation is invoked only if the data processing operation throws an
unhandled exception.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Create a TaskCompletionSource<T> object and call the TrySetException() method of the object.

B.
Create a task by calling the Task.ContinueWith() method.

C.
Examine the Task.Status property immediately after the call to the Task.Run() method.

D.
Create a task inside the existing Task.Run() method by using the AttachedToParent option.

One Comment on “You need to ensure that the second operation is invoked…

  1. Paul says:

    My first reaction was A iso B. Some reading learned that A requires the exception to be handled and thereby invalidating the requirement that the exception should not be handled. A tricky question indeed.




    0



    0

Leave a Reply