Commit 5e39089
authored
Log unhandled exceptions thrown from command actions (#2114)
This PR adds explicit stderr logging for any exception thrown out of an
ImageBuilder command's action handler.
The root cause is that `System.CommandLine`'s default exception handler
silently swallows `OperationCanceledException` (and
`TaskCanceledException`, which derives from it), returning exit code 1
with zero diagnostic output. This makes any failure that surfaces as a
cancellation invisible in pipeline logs (e.g. `HttpClient` timeout). The
`check-base-image-updates` pipeline has been failing this way: after
`READING MANIFEST`, the process exits 1 with no stack trace.
This PR wraps the action body in `Command.TOptions.cs` with a try/catch
that writes the full exception to `Console.Error`.
Upstream issue: dotnet/command-line-api#28081 parent d8a3225 commit 5e39089
1 file changed
Lines changed: 20 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
41 | 56 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| |||
0 commit comments