Skip to content

test(app): write the log tick from a dedicated thread - #57

Merged
FedeB2160 merged 1 commit into
mainfrom
claude/relaxed-matsumoto-ceec81
Nov 10, 2026
Merged

FedeB2160 merged 1 commit into
mainfrom
claude/relaxed-matsumoto-ceec81

Conversation

@FedeB2160

Copy link
Copy Markdown
Owner

AppStateTests.LinesFromAnotherThreadArePostedToTheUi failed about 3 times in 14 solution runs with Assert.Equal() Failure: Expected: 1 Actual: 0.

LogViewModel posts to the UI context only when Write runs on a thread other than the one that built it. Task.Run could reuse that same pool thread, so no Post happened. The test now writes from a new Thread and joins it. Product code unchanged: in the app the log is built on the UI thread.

Verified: 30 consecutive runs of dotnet test --solution app\WinGetStudio.sln, all green.

Not covered: an earlier batch had one failure of another, unidentified test and one test-host crash (0xC0000602, fail-fast) — not reproduced in the 30 runs.

Co-Authored-By: Claude noreply@anthropic.com

Task.Run could run Write on the pool thread that had built the
LogViewModel, so no Post happened and the test failed about once in
five solution runs. A new Thread plus Join is always another thread.

Co-Authored-By: Claude <noreply@anthropic.com>
@FedeB2160
FedeB2160 merged commit f7bd408 into main Nov 10, 2026
3 checks passed
@FedeB2160
FedeB2160 deleted the claude/relaxed-matsumoto-ceec81 branch November 10, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant