Skip to content

Fix AbortTest.Abort_ConnectAndAbort_ThrowsWebSocketExceptionWithmessage on NodeJS #63673

@maraf

Description

@maraf

Running test on NodeJS causes uncaught exception

WebSocket uri 'wss://127.0.0.1:60051/WebSocket/EchoWebSocket.ashx?delay10sec'
OperationCanceledException 1
System.Runtime.InteropServices.JavaScript.JSException: Error: WebSocket was closed before the connection was established
  at WebSocket.close (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\node_modules\ws\lib\websocket.js:284:14)
  at Object.mono_wasm_web_socket_abort (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:3737:16)
  at _mono_wasm_web_socket_abort (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:10771:71)
  at do_icall (wasm://wasm/02c17daa:wasm-function[309]:0x2dd4d)
  at do_icall_wrapper (wasm://wasm/02c17daa:wasm-function[268]:0x2c450)
  at interp_exec_method (wasm://wasm/02c17daa:wasm-function[203]:0xc6ad)
  at interp_runtime_invoke (wasm://wasm/02c17daa:wasm-function[202]:0xa8ce)
  at mono_jit_runtime_invoke (wasm://wasm/02c17daa:wasm-function[14961]:0x288c2a)
  at do_runtime_invoke (wasm://wasm/02c17daa:wasm-function[3336]:0xfe90a)
  at mono_runtime_invoke_checked (wasm://wasm/02c17daa:wasm-function[3334]:0xfe7e6)
  at mono_runtime_try_invoke_span (wasm://wasm/02c17daa:wasm-function[3479]:0x1073bf)
  at mono_runtime_invoke_span_checked (wasm://wasm/02c17daa:wasm-function[3480]:0x107722)
  at ves_icall_InternalInvoke (wasm://wasm/02c17daa:wasm-function[2016]:0xb53c7)
  at ves_icall_InternalInvoke_raw (wasm://wasm/02c17daa:wasm-function[2252]:0xc515b)
  at do_icall (wasm://wasm/02c17daa:wasm-function[309]:0x2de47)
  at do_icall_wrapper (wasm://wasm/02c17daa:wasm-function[268]:0x2c450)
  at interp_exec_method (wasm://wasm/02c17daa:wasm-function[203]:0xc6ad)
  at interp_runtime_invoke (wasm://wasm/02c17daa:wasm-function[202]:0xa8ce)
  at mono_jit_runtime_invoke (wasm://wasm/02c17daa:wasm-function[14961]:0x288c2a)
  at do_runtime_invoke (wasm://wasm/02c17daa:wasm-function[3336]:0xfe90a)
  at mono_runtime_try_invoke (wasm://wasm/02c17daa:wasm-function[3350]:0xff5d3)
  at mono_runtime_invoke (wasm://wasm/02c17daa:wasm-function[3414]:0x1036d0)
  at mono_wasm_invoke_method (wasm://wasm/02c17daa:wasm-function[137]:0x8ad8)
  at Module._mono_wasm_invoke_method (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:11470:117)
  at Object.wf.<computed> (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:126:20)
  at _call_method_with_converted_args (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:2367:48)
  at call_method (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:2329:16)
  at C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:2397:20
  at mono_call_assembly_entry_point (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:2404:67)
  at Object.mono_run_main (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:3966:16)
  at Object.init (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\test-main.js:212:43)
  at Object.onDotnetReady (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\test-main.js:151:17)
  at finalize_startup (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:3062:31)
  at mono_wasm_on_runtime_initialized (C:\Development\dotnet\runtime\artifacts\bin\System.Net.WebSockets.Client.Tests\net7.0-Browser-Debug\browser-wasm\AppBundle\dotnet.js:2925:9)
  at System.Runtime.InteropServices.JavaScript.Runtime.WebSocketAbort(JSObject webSocket) in C:\Development\dotnet\runtime\src\libraries\System.Private.Runtime.InteropServices.JavaScript\src\System\Runtime\InteropServices\JavaScript\Runtime.cs:line 297
  at System.Net.WebSockets.BrowserWebSocket.Abort() in C:\Development\dotnet\runtime\src\libraries\System.Net.WebSockets.Client\src\System\Net\WebSockets\BrowserWebSockets\BrowserWebSocket.cs:line 146
  at System.Net.WebSockets.WebSocketHandle.Abort() in C:\Development\dotnet\runtime\src\libraries\System.Net.WebSockets.Client\src\System\Net\WebSockets\WebSocketHandle.Browser.cs:line 27
  at System.Net.WebSockets.ClientWebSocket.Abort() in C:\Development\dotnet\runtime\src\libraries\System.Net.WebSockets.Client\src\System\Net\WebSockets\ClientWebSocket.cs:line 148
  at System.Net.WebSockets.Client.Tests.AbortTest.Abort_ConnectAndAbort_ThrowsWebSocketExceptionWithmessage(Uri server) in C:\Development\dotnet\runtime\src\libraries\System.Net.WebSockets.Client\tests\AbortTest.cs:line 32

WebSocket.js throws Error when WS is in the state CONNECTING.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions