Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent "Sequence contains no elements" in browser tests #1261

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Sep 6, 2024

Follow up for #1221.
Contributes to dotnet/runtime#107466.
In dotnet/runtime#107259 we discovered very frequent timeouts on Windows with newer chrome version, with logs:

          [wasm test-browser] info: Closing 2 browser tabs before setting the main tab to config page and quitting.
          [wasm test-browser] fail: Error while closing browser: System.InvalidOperationException: Sequence contains no elements
          [wasm test-browser]          at System.Linq.ThrowHelper.ThrowNoElementsException()
          [wasm test-browser]          at Microsoft.DotNet.XHarness.CLI.Commands.Wasm.WasmTestBrowserCommand.InvokeInternal(ILogger logger)
          [wasm test-browser] XHarness exit code: 0

It suggests that in the try-catch block we're using LINQ function on an empty collection. It might happen if closing of tabs did not happen instantly but with a slight delay. Then the while condition was still true but when we call Last(), windowHandles is already an empty collection.
This should fix it.

@ilonatommy ilonatommy added the wasm WASM area label Sep 6, 2024
@ilonatommy ilonatommy self-assigned this Sep 6, 2024
@ilonatommy ilonatommy changed the title Capture the collection bewteen the check of elements and LINQ action … Prevent "Sequence contains no elements" in browser tests Sep 6, 2024
@ilonatommy
Copy link
Member Author

/ba-g Android failures are not connected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasm WASM area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants