diff --git a/docs/csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md b/docs/csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md index 183ff2388df3e..06114c2197027 100644 --- a/docs/csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md +++ b/docs/csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md @@ -43,7 +43,7 @@ static async Task Main() await SumPageSizesAsync(); } - catch (TaskCanceledException) + catch (OperationCanceledException) { Console.WriteLine("\nTasks cancelled: timed out.\n"); } @@ -58,7 +58,7 @@ static async Task Main() The updated `Main` method writes a few instructional messages to the console. Within the [try catch](../../../language-reference/keywords/try-catch.md), a call to schedules a cancellation. This will signal cancellation after a period of time. -Next, the `SumPageSizesAsync` method is awaited. If processing all of the URLs occurs faster than the scheduled cancellation, the application ends. However, if the scheduled cancellation is triggered before all of the URLs are processed, a is thrown. +Next, the `SumPageSizesAsync` method is awaited. If processing all of the URLs occurs faster than the scheduled cancellation, the application ends. However, if the scheduled cancellation is triggered before all of the URLs are processed, a is thrown. ### Example application output diff --git a/docs/csharp/programming-guide/concepts/async/snippets/cancel-tasks/cancel-task-after-period-of-time/Program.cs b/docs/csharp/programming-guide/concepts/async/snippets/cancel-tasks/cancel-task-after-period-of-time/Program.cs index 6b780341e4931..41486960ff6cf 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/cancel-tasks/cancel-task-after-period-of-time/Program.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/cancel-tasks/cancel-task-after-period-of-time/Program.cs @@ -47,7 +47,7 @@ static async Task Main() await SumPageSizesAsync(); } - catch (TaskCanceledException) + catch (OperationCanceledException) { Console.WriteLine("\nTasks cancelled: timed out.\n"); }