A pending Task<T> can hang the failure message in a trimmed app
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Start in src/Vouch/Formatting/Formatter.cs, reading SafeMembers, the Write chain, and MemberCache.IsSafeOnly to understand how trimming affects the safe-member lookup and equivalency. Reproduce the hang with a trimmed app that fails an assertion on a pending Task<int>, then check the existing FormatterTests cases for Task<Int32> and Lazy<Int32>. Done means the trimmed app prints the task status and exits, those tests pass, and the Release build completes with zero warnings.
Written by the indexing model from the issue text.
Description
Goal
In a trimmed app, a failure message that prints a pending Task<T>, ValueTask<T> or Lazy<T> still prints only its safe member and never blocks or runs the factory.
Where
src/Vouch/Formatting/Formatter.cs:SafeMembers(looks upStatus,IsCompleted,IsValueCreatedwithGetProperty) and theWritechain that calls it.
Found while checking the CodeRabbit thread on #51. Read in the code, not yet reproduced in a trimmed publish.
If trimming removed Task.Status, SafeMembers returns null and Write falls through to the unrestricted WriteObject, which reads every public property. On a task that has not finished, Task<T>.Result blocks, so writing the failure message hangs. ValueTask<T> falls back to Result the same way, and Lazy<T> to Value, which runs the factory. This path is older than #51, which only added the trim annotations.
Likely fix: [DynamicDependency] on SafeMembers for those members, so trimming keeps them. Another option is to print the type name alone when the safe member is missing.
Done when
- A trimmed publish of a small app that fails an assertion on a pending
Task<int>printsStatus = WaitingForActivationand exits. FormatterTestsstill pass, including theTask<Int32> { Status = WaitingForActivation }andLazy<Int32> { IsValueCreated = false }cases.dotnet build src/Vouch -c Release -warnaserrorgives 0 warnings.
Risks
MemberCachecallsIsSafeOnly, which also usesSafeMembers. Equivalency must not change.
Out of scope
Other members WriteObject reads.
- Dominant language
- C#
- Stars
- 0
- Forks
- 1
- Avg merge
- 1h 56m
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BaryoDev/Vouch
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Roadmap to 1.0: FluentAssertions parity, small core plus opt-in packagesMay be free again @arnelirobles claimed this 28 days ago, and no pull request is open. Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
BaryoDev/Vouch#20 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Facepunch/sbox-public#12456 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
mcneel/rhino.inside-revit#1736 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
reactiveui/Primitives#254 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Kyrodan/KeeAnywhere#510 ·
-
area-Tools-ILLink untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day