Commit 4286701
refactor: apply idiomatic C# safety fixes across SDK
Phase 3 of refactor-plan.md.
The plan §6 violation scan claimed ~22 awaits missing ConfigureAwait
and 3+ public-async sites missing CancellationToken; on a second
pass with a multi-line-aware scan, those are false positives — all
85 awaits in src/ already call ConfigureAwait(false), and the
3 public-async sites already accept a CT. AgentRegistry.Versions
was flagged as a Tier-1 mutable-collection leak; it's a property on
a private nested class, so it's never on the public surface.
Real changes:
- SessionState.RunAsync now accepts a CancellationToken and links
it to the internal CTS. ArcpServer.AcceptAsync forwards its own
token through (fixes CA2016 that surfaced from the signature
change).
- ArcpClient.ReaderLoop: replace empty `catch (OperationCanceledException)`
with a one-line justification comment.
- ArcpClient.DisposeAsync: replace bare `catch { }` with typed
`catch (Exception)` + comment.
- Samples SubmitAndStream / LeaseViolation: forward `ct` through to
context calls to clear the three lingering CA2016 warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2aa7e47 commit 4286701
5 files changed
Lines changed: 20 additions & 12 deletions
File tree
- samples
- LeaseViolation
- SubmitAndStream
- src
- Arcp.Client
- Arcp.Runtime
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
306 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | | - | |
79 | | - | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
0 commit comments