Repository navigation
test(app): write the log tick from a dedicated thread - #57
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AppStateTests.LinesFromAnotherThreadArePostedToTheUifailed about 3 times in 14 solution runs withAssert.Equal() Failure: Expected: 1 Actual: 0.LogViewModelposts to the UI context only whenWriteruns on a thread other than the one that built it.Task.Runcould reuse that same pool thread, so noPosthappened. The test now writes from anew Threadand 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