try { some code here Task<T> task = SomeTask(); T result = null; while (someCondition) try { result = task.Result; } catch (TaskCanceledException te) { code here } catch (WebException we) { code here } } // close while loop if (result!=null) { some code here } } close try catch (Exception e) { main catch here }When I'm debugging my test, I am always hitting the outer exception and not the inner exception. The line result = task.Result generates the error. The inner exceptions says that task was cancelled.