dotnet / dotnet/dotnet-api-docs
Example in AggregateException doc is not work
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Hi,
I run the example which in [AggregateException doc](https://learn.microsoft.com/en-us/dotnet/api/system.aggregateexception?view=net-7.0&source=docs#examples), the example code did not catch an AggregateException, the following code will not work:
```c#
catch (AggregateException ae)
{
Console.WriteLine("Caught aggregate exception-Task.Wait behavior");
ae.Handle((x) =>
{
if (x is UnauthorizedAccessException) // This we know how to handle.
{
Console.WriteLine("You do not have permission to access all folders in this path.");
Console.WriteLine("See your network administrator or try another path.");
return true;
}
return false; // Let anything else stop the application.
});
}
```
My environment:
+ .net 7.0
+ Win10
Contributor guide
Assessment
This issue has not been assessed yet.