You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tighten the Last-Frame Exception Wording in the .NET Code Style #4528
The .NET console app interrupt rule in CODESTYLE.md "Interrupts in .NET" and the dotnet-codestyle Skill carry two defects a local review raised on the final head of the pull request that introduced them. That pull request's edit budget was spent, so both are deferred here.
The leftover-removal example bound does not fit inside the container stop grace. "Interrupts in .NET" puts the kill bound below the container stop grace, 10 seconds by default, at a value such as 5 seconds. The bullet on what a child leaves behind gives the removal its own bound, "such as 10 seconds". For an app running as PID 1 whose child starts a sibling container, a docker stop can spend up to the kill bound on the child and then up to the removal bound on the removal. At the example values the removal and the log flush run past the 10-second grace, so the container runtime kills the app and the sibling container stays behind. The example value, or the rule's relation between the removal bound and the stop grace, needs a decision.
Item 5's pointer misses the unhandled-exception handler.dotnet-codestyle item 5 ("do not swallow exceptions") names the last-frame catches, the unhandled-exception handler's guards among them, and points at "Interrupts in .NET". That handler is described in "Unhandled Exceptions in .NET", and neither section mentions its guards. The pointer should name both sections.
Recommendation
For the first, state the removal bound as fitting inside the container stop grace together with the kill bound, with an example such as 3 seconds. For the second, point item 5 at "Interrupts in .NET" and "Unhandled Exceptions in .NET".
Deferred From the Final Review of the Introducing Pull Request
Both items in the body above are fixed in the pull request that introduced the rule. Its final local review raised two more on dotnet-codestyle item 5's last-frame exception, deferred here because that pull request's last round allowed no further edits.
The cited sections state only some of the frames item 5 names. Item 5 names the entry point's final catch, a signal handler, the unhandled-exception handler's guards, and a fault-reporting callback, citing "Interrupts in .NET" and "Unhandled Exceptions in .NET". Those sections state the signal handler's catch-all and the fault-reporting callback. They give Main a try whose finally flushes the log, with no final catch, and describe the unhandled-exception handler with no guard. The entry point's final catch and the handler's guards appear only in the reference skeleton.
The stated reason holds for only some of the frames. "Does not rethrow, since nothing above it can" is true for a signal handler and for the unhandled-exception handler's own guards. A rethrow from Main or from a fault-reporting callback reaches the UnhandledException handler, which "Unhandled Exceptions in .NET" has log and flush. The reasons there are different: Main turns a failure into the error exit status, and an exception escaping a callback aborts the process before cleanup.
Recommendation
State the reason per frame kind, or reword the principle as "a catch where a rethrow would only reach the unhandled-exception path", and name the entry point's final catch in "Interrupts in .NET" so the citation covers every frame item 5 lists.
The pull request that this issue follows merged into develop, and it carries both points in the body above. The removal bound is stated against the stop grace, and item 5 points at both sections.
What stays open is the pair of wording gaps in the comment above, on item 5's last-frame sentence. The title now names that.
changed the title [-]Fit the .NET Leftover-Removal Bound Inside the Stop Grace and Point Item 5 at Both Sections[/-][+]Tighten the Last-Frame Exception Wording in the .NET Code Style[/+]on Nov 28, 2026
Related PR: #4544 widens item 5's translate arm so a bounded cancellation may become a domain result, matching the ToolRunner skeleton. Four precision follow-ups from its local review are listed in that PR body.
Two wording follow-ups from the last local review of #4544, deferred here: (1) item 5 does not require a caller of an outcome-returning boundary to stop on a cancelled outcome or check the stop token itself. (2) 'Translate a fault' collides with the CODESTYLE 'Interrupts in .NET' meaning of fault, so 'failure' reads better.
Activity
ptr727 commentedon Nov 27, 2026
Deferred From the Final Review of the Introducing Pull Request
Both items in the body above are fixed in the pull request that introduced the rule. Its final local review raised two more on
dotnet-codestyleitem 5's last-frame exception, deferred here because that pull request's last round allowed no further edits.Mainatrywhosefinallyflushes the log, with no final catch, and describe the unhandled-exception handler with no guard. The entry point's final catch and the handler's guards appear only in the reference skeleton.Mainor from a fault-reporting callback reaches theUnhandledExceptionhandler, which "Unhandled Exceptions in .NET" has log and flush. The reasons there are different:Mainturns a failure into the error exit status, and an exception escaping a callback aborts the process before cleanup.Recommendation
State the reason per frame kind, or reword the principle as "a catch where a rethrow would only reach the unhandled-exception path", and name the entry point's final catch in "Interrupts in .NET" so the citation covers every frame item 5 lists.
Fit the Leftover-Removal Bound Inside the Stop Grace
Extend the Interrupt Rule to .NET Console Apps (#4521)
ptr727 commentedon Nov 28, 2026
State After the Merge
The pull request that this issue follows merged into
develop, and it carries both points in the body above. The removal bound is stated against the stop grace, and item 5 points at both sections.What stays open is the pair of wording gaps in the comment above, on item 5's last-frame sentence. The title now names that.
[-]Fit the .NET Leftover-Removal Bound Inside the Stop Grace and Point Item 5 at Both Sections[/-][+]Tighten the Last-Frame Exception Wording in the .NET Code Style[/+]ptr727 commentedon Nov 29, 2026
Related PR: #4544 widens item 5's translate arm so a bounded cancellation may become a domain result, matching the ToolRunner skeleton. Four precision follow-ups from its local review are listed in that PR body.
ptr727 commentedon Nov 29, 2026
Two wording follow-ups from the last local review of #4544, deferred here: (1) item 5 does not require a caller of an outcome-returning boundary to stop on a cancelled outcome or check the stop token itself. (2) 'Translate a fault' collides with the CODESTYLE 'Interrupts in .NET' meaning of fault, so 'failure' reads better.
Let a Bounded Cancellation Translate to a Domain Result in the .NET R…
Promote Develop to Main: setup-github gh Key Add and .NET Packing (#4542