Repository navigation
DevFlow (.NET 10): document WebView targeting and error handling; remove webview network alias - #3634
jfversluis wants to merge 4 commits into
Conversation
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit ecab3b5: ✅ Validation status: passed
For more details, please refer to the build report. |
There was a problem hiding this comment.
🟡 Changes recommended
The documentation contains incorrect guidance on CDP request bodies, HTTP error exceptions, and webview-response validation, which could lead callers to send invalid requests or mishandle failures.
3 open issues
What changed in this PR
Updates the .NET MAUI DevFlow documentation for WebView targeting and changed error handling, addressing #3584 and #3590.
Changes:
- Documents WebView selection, CLI commands, and a working bridge setup snippet.
- Adds HTTP endpoint and AgentClient method references, plus CLI and MCP failure guidance.
- Corrects the CDP tool list and clarifies native-only network monitoring and the removed network alias.
| File | Description |
|---|---|
docs/developer-tools/devflow/mcp-tools.md |
Corrects CDP tools and documents targeting and error results. |
docs/developer-tools/devflow/blazor-cdp.md |
Expands setup, CLI targeting, commands, and error-handling guidance. |
docs/developer-tools/devflow/agent-client.md |
Adds WebView method signatures and exception guidance. |
docs/developer-tools/devflow/agent-api.md |
Documents WebView routes and the removed network alias. |
Review effort: Balanced
|
|
||
| ### POST /api/v1/webview/evaluate | ||
|
|
||
| Evaluates a JavaScript expression in the target WebView. |
| Except for `GetCdpWebViewsAsync`, these methods throw an exception when a WebView command fails, instead of returning an unsuccessful result: | ||
|
|
||
| - HTTP failures throw `HttpRequestException`, and the exception message includes the response body. | ||
| - CDP, protocol, and JavaScript failures throw `InvalidOperationException`. JavaScript exceptions include the original error description. |
| - CDP, protocol, and JavaScript failures throw `InvalidOperationException`. JavaScript exceptions include the original error description. | ||
| - Invalid JSON responses throw `JsonException`. | ||
|
|
||
| `GetCdpWebViewsAsync` doesn't throw on failure. Instead, it returns a `JsonElement` whose `ValueKind` is `JsonValueKind.Undefined`, so check `ValueKind` before you read the result. |
…t hardcode 9223 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 0e878dc: ✅ Validation status: passed
For more details, please refer to the build report. |
… conflict with #3634 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…selection order Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 9d09835: ✅ Validation status: passed
For more details, please refer to the build report. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit d00c973: ✅ Validation status: passed
For more details, please refer to the build report. |

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
d00c973c29846cf29bbc928a9432bf7a0958db10↑ WebView selection order checked against
ResolveCdpWebViewandResolveReadyCdpWebViewAsync.↑ Two-WebView Mac Catalyst runtime checks covered explicit targeting, default active-ready selection, errors, and the removed endpoint; the discovered-port HTTP example returned 200.
↑ Overlapping MCP reference changes were removed after comparison with #3638; both heads merge cleanly in either order.
↓ Numeric AutomationId precedence, not-ready fallback behavior, AgentClient exception types, and MCP tool errors were checked from source only.
↓ Docs build and xref validation were not run locally; CI for this revision was not inspected.
Fixes #3584
Fixes #3590
Summary
These doc changes cover the DevFlow WebView targeting and error-handling changes, plus the removal of the
/api/v1/webview/networkalias.blazor-cdp.md:maui devflow webviewas the primary command (cdpremains an alias). Addwebviews, the recursive--webview/-woption (index, AutomationId, or element ID), the default WebView selection behavior, and a full command table.Element not foundis shown, and MCP tool errors are covered.webviewquery parameter.agent-api.md: New WebView endpoints section listing the real routes. Explainswebviewand thecontextIdalias, noting that evaluate accepts onlywebviewand console ignores both. Adds a note that/api/v1/webview/networkwas removed and returns 404, so use/api/v1/network/requests.agent-client.md: New WebView methods section with exact signatures and exception behavior (HttpRequestException,InvalidOperationException,JsonException;Task<bool>methods throw instead of returningfalse;GetCdpWebViewsAsyncreturns an undefinedJsonElement).blazor-cdp.mdnow documents the full matching order (index first for numeric values, then AutomationId, then element ID, case-insensitive, newest match wins) and the default order (active ready, active, newest ready, newest). Theagent-api.mdandagent-client.mdpages summarize it and link there.curlexamples inblazor-cdp.mdandagent-api.mdnow look up the broker-assigned port withmaui devflow list --jsoninstead of hardcoding 9223.mcp-tools.md.Upstream verification
/api/v1/webview/network).DevFlowCommands.cs,CdpTools.cs,AgentClient.cs,DevFlowAgentService.Handlers.cs,docs/DevFlow/spec/openapi.yaml,src/DevFlow/README.md.Microsoft.Maui.Cli0.1.0-preview.16.26575.3 package.Limitations and follow-ups (not changed here)
--webviewhelp says "default: first WebView", but actual selection prefers active WebViews and then falls back to recently registered WebViews. The docs describe the actual behavior.maui devflow cdp --helpprints the parentdevflowhelp (alias help quirk). The commands themselves route correctly.agent-client.mdlists the package asMicrosoft.Maui.DevFlow.Driver, but the sourcePackageIdisMicrosoft.Maui.DevFlow.Clientand it isn't published by default. This was left out of scope.mcp-tools.mdentries (for example,maui_interact_*) don't match current tool names. The MCP reference is addressed separately in DevFlow: refresh MCP tools reference #3638.Internal previews
Build report
Another DevFlow session is driving this app. This affects quickly scripted sequences such as the fill/insertText/click example. Not changed here; worth an upstream fix or a docs follow-up.