The test fails sometimes with:
```
[02:40:04] dbug: Inspector-3[0] Failing all waiters because: Runtime.exceptionThrown: { "timestamp": 1643683204929.399, "exceptionDetails": { "exceptionId": 2, "text": "Uncaught", "lineNumber": 0, "columnNumber": 31, "scriptId": "32", "stackTrace": { "callFrames": [ { "functionName": "", "scriptId": "32", "url": "", "lineNumber": 0, "columnNumber": 31 } ] }, "exception": { "type": "object", "subtype": "error", "className": "ReferenceError", "description": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32", "objectId": "1487416918028189685.1.57", "preview": { "type": "object", "subtype": "error", "description": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32", "overflow": false, "properties": [ { "name": "stack", "type": "string", "value": "ReferenceError: non_existant_fn is not defined\n at <anonymous>:1:32" }, { "name": "message", "type": "string", "value": "non_existant_fn is not defined" } ] } }, "executionContextId": 1 } }
[02:41:02] dbug: InspectorClient-3[0] Socket is no longer open
[02:41:02] dbug: InspectorClient-3[0] RunLoop stopped, reason: Cancelled. (parentToken: True, linked: True):
[02:41:02] dbug: InspectorClient-3[0] Failing 0 pending cmds
[02:41:02] dbug: InspectorClient-3[0] Loop ended with socket: Aborted
[02:41:03] dbug: InspectorClient-4[0] connecting to ws://localhost:9400/launch-chrome-and-connect/?test_id=4
[xUnit.net 00:02:07.56] DebuggerTests.HarnessTests.ExceptionThrown [FAIL]
[02:41:03] info: Microsoft.WebAssembly.Diagnostics.TestHarnessProxy[0] [testId: 4] New test request for test id 4
Failed DebuggerTests.HarnessTests.ExceptionThrown [58 s]
Error Message:
Assert.Throws() Failure
Expected: typeof(System.ArgumentException)
Actual: typeof(System.Threading.Tasks.TaskCanceledException): Test timed out (elapsed time: 60.0062617)
---- System.Threading.Tasks.TaskCanceledException : Test timed out (elapsed time: 60.0062617)
Stack Trace:
at DebuggerTests.DebuggerTestBase.SendCommandAndCheck(JObject args, String method, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn, String waitForEvent) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 523
at DebuggerTests.DebuggerTestBase.EvaluateAndCheck(String expression, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 507
at DebuggerTests.HarnessTests.<ExceptionThrown>b__1_0() in /_/src/mono/wasm/debugger/DebuggerTestSuite/HarnessTests.cs:line 30
----- Inner Stack Trace -----
at DebuggerTests.DebuggerTestBase.SendCommandAndCheck(JObject args, String method, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn, String waitForEvent) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 523
at DebuggerTests.DebuggerTestBase.EvaluateAndCheck(String expression, String script_loc, Int32 line, Int32 column, String function_name, Func`2 wait_for_event_fn, Func`2 locals_fn) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 507
at DebuggerTests.HarnessTests.<ExceptionThrown>b__1_0() in /_/src/mono/wasm/debugger/DebuggerTestSuite/HarnessTests.cs:line 30
```
The test uses `SendCommand` to evaluate
`("window.setTimeout(function() { non_existant_fn(); }, 1)`
which tries to invoke the `non_existant_fn` after 1ms. This causes a
`Runtime.exceptionThrown` event message to be received, and the
`Inspector` fails any waiters (eg. `insp.WaitFor(READY)`).
So we have:
1. SendCommand
2. insp.WaitFor
But the `Runtime.exceptionThrown` can be received before we get to (2),
thus the waiter from (2) never gets failed, and instead times out.