Fix unhandled synchronous throw from WebSocket ConnectAsync - #15783
Merged
Julio César Rocha (JunielKatarn) merged 5 commits intoMar 16, 2026
Merged
Conversation
(Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path.
Tommy Nguyen (tido64)
approved these changes
Mar 16, 2026
Saad Najmi (Saadnajmi)
approved these changes
Mar 16, 2026
… OC/11296967/wsconex
Julio César Rocha (JunielKatarn)
enabled auto-merge (squash)
March 16, 2026 22:25
Julio César Rocha (JunielKatarn)
merged commit Mar 16, 2026
40efcf3
into
microsoft:main
32 checks passed
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
This was referenced Mar 17, 2026
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
This was referenced Mar 17, 2026
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
to jurocha-ms/react-native-windows
that referenced
this pull request
Mar 17, 2026
…t#15783) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
that referenced
this pull request
Mar 17, 2026
…15796) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
that referenced
this pull request
Mar 17, 2026
…15791) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
that referenced
this pull request
Mar 17, 2026
…15789) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
that referenced
this pull request
Mar 17, 2026
…15788) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
Julio César Rocha (JunielKatarn)
added a commit
that referenced
this pull request
Mar 17, 2026
…15790) * Fix unhandled synchronous throw from ConnectAsync (Generated summary) ConnectAsync can throw synchronously (e.g. WININET_E_INVALID_CA / 0x80072EE1 on certificate validation failure) before returning an IAsyncAction. Move the call inside the existing try/catch block so such exceptions are routed through Fail() instead of propagating unhandled. Add ConnectAsyncThrowsSynchronously unit test to cover this path. * Change files * Add explaining comment * clang format
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.
Description
Handle synchronous exceptions from
IMessageWebSocket::ConnectAsync.Type of Change
Why
Unexpected WebSocket connection errors may cause a synchronous exception to be thrown, which is not converted into an HRESULT by the
lessthrow_awiat_adapterbecause it only handles asynchronous exceptions originated during the coroutine suspend/resume cycle.What
Add the
ConnectAsynccall to an existingtry-catchhandling block in the same code block.Testing
Added test
WinRTWebSocketResourceUnitTest::ConnectAsyncThrowsSynchronously.Changelog
No
Microsoft Reviewers: Open in CodeFlow