-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
The BlazorWebView device test RequestsCanBeInterceptedAndHeadersAddedForDifferentHosts(uriBase: "app://echoservice/") is flaky on CoreCLR MacCatalyst. It depends on an external echo service (https://echo.free.beeceptor.com/sample-request) which makes it unreliable in CI.
Failure Details
- Test:
RequestsCanBeInterceptedAndHeadersAddedForDifferentHosts(uriBase: "app://echoservice/") - Error:
Assert.NotNull() Failure: Value is null(onresponseObject.headers) - Platform: CoreCLR MacCatalyst on
osx.15.arm64.maui.open - Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1282686&view=ms.vss-test-web.build-test-results-tab&runId=35819496&resultId=100136&paneView=debug
Root Cause
The iOS/MacCatalyst code path in this test (BlazorWebViewTests.RequestInterception.cs:178-229):
- Intercepts the
app://echoservice/fetch request - Creates a copy of the
NSUrlRequestand changes the URL tohttps://echo.free.beeceptor.com/sample-request(an external third-party service) - Adds a custom
X-Request-Header - Sends the modified request via
NSUrlSession - The echo service is expected to reflect headers back in the JSON response body
The test fails when the external service does not respond as expected (network issues, service downtime, rate limiting).
In the failing build, the same test passed on Mono MacCatalyst (13/13) but failed on CoreCLR MacCatalyst (12/13), suggesting either network flakiness across machines or a possible CoreCLR-specific interop difference with NSUrlSession.
Suggested Fix
Replace the external echo.free.beeceptor.com dependency with a local/self-hosted echo mechanism to make the test deterministic. The test should verify header interception without relying on third-party services.
Additional context
The following tests in the same file also depend on the same external echo service and may be similarly affected:
RequestsCanBeInterceptedAndCustomDataReturnedForDifferentHostsRequestsCanBeInterceptedAndCancelledForDifferentHostsRequestsCanBeInterceptedAndCaseInsensitiveHeadersRead