Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Robust Async Error Handling | Timeouts, Parallelism, and Error Handling
C# Async and Await Practice

bookChallenge: Robust Async Error Handling

Tâche

Swipe to start coding

Write a C# console application that demonstrates error handling in async methods.

  • Implement the ThrowingAsyncMethod so that it simulates asynchronous work (such as with Task.Delay) and then throws an exception with the message Error occurred in async method!.
  • In the Main method, call ThrowingAsyncMethod using await inside a try/catch block.
  • When the exception is caught, print the exception message to the console using Console.WriteLine.
  • Ensure your program can be run and the exception message is displayed correctly when the async method fails.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 6
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Robust Async Error Handling

Glissez pour afficher le menu

Tâche

Swipe to start coding

Write a C# console application that demonstrates error handling in async methods.

  • Implement the ThrowingAsyncMethod so that it simulates asynchronous work (such as with Task.Delay) and then throws an exception with the message Error occurred in async method!.
  • In the Main method, call ThrowingAsyncMethod using await inside a try/catch block.
  • When the exception is caught, print the exception message to the console using Console.WriteLine.
  • Ensure your program can be run and the exception message is displayed correctly when the async method fails.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 6
single

single

some-alt