0

Below code is never entering into "Do something A" section. Breakpoint not getting hit. It's always going into IsCanceled state.

Task process = new Task<byte[]>(() => {
                        //Do something A
                        return Client.ReadData(stringToSend);
                    }, token).ContinueWith((r) => {
                        if (r.IsCompleted && r.Status == TaskStatus.RanToCompletion) {
                            //Do something B
                        }
                        else if (r.IsFaulted) {
                            //Do something C
                        }
                        else if (r.IsCanceled) {
                            //Do something D
                            }
                        }
                    });
Shantanu Gupta
  • 20,688
  • 54
  • 182
  • 286

0 Answers0