Skip to content

DevFlow (.NET 10): document WebView targeting and error handling; remove webview network alias - #3634

Open
jfversluis wants to merge 4 commits into
mainfrom
jfversluis-devflow-webview-targeting-docs
Open

jfversluis wants to merge 4 commits into
mainfrom
jfversluis-devflow-webview-targeting-docs

Conversation

@jfversluis

@jfversluis jfversluis commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: d00c973c29846cf29bbc928a9432bf7a0958db10

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ CLI, endpoint, MCP, and AgentClient names checked against dotnet/maui-labs at 8f53402, matching shipped preview 0.1.0-preview.16.26575.3.
↑ WebView selection order checked against ResolveCdpWebView and ResolveReadyCdpWebViewAsync.
↑ 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/network alias.

  • blazor-cdp.md:
    • Use maui devflow webview as the primary command (cdp remains an alias). Add webviews, the recursive --webview/-w option (index, AutomationId, or element ID), the default WebView selection behavior, and a full command table.
    • Add error handling: errors go to stderr with a nonzero exit, Element not found is shown, and MCP tool errors are covered.
    • Document the HTTP webview query parameter.
    • Fix the setup snippet. Remove the claim that the bridge captures WebView network traffic; DevFlow network monitoring covers native .NET HTTP only.
  • agent-api.md: New WebView endpoints section listing the real routes. Explains webview and the contextId alias, noting that evaluate accepts only webview and console ignores both. Adds a note that /api/v1/webview/network was 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 returning false; GetCdpWebViewsAsync returns an undefined JsonElement).
  • WebView selection: blazor-cdp.md now 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). The agent-api.md and agent-client.md pages summarize it and link there.
  • Agent port: The curl examples in blazor-cdp.md and agent-api.md now look up the broker-assigned port with maui devflow list --json instead of hardcoding 9223.
  • MCP reference: DevFlow: refresh MCP tools reference #3638 owns the MCP tools reference refresh, including the CDP tool inventory and WebView targeting and error guidance. This PR no longer changes mcp-tools.md.

Upstream verification

Limitations and follow-ups (not changed here)

  • In the shipped CLI, --webview help 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 --help prints the parent devflow help (alias help quirk). The commands themselves route correctly.
  • agent-client.md lists the package as Microsoft.Maui.DevFlow.Driver, but the source PackageId is Microsoft.Maui.DevFlow.Client and it isn't published by default. This was left out of scope.
  • Other pre-existing mcp-tools.md entries (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

File Preview link
docs/developer-tools/devflow/agent-api.md Learn preview
docs/developer-tools/devflow/agent-client.md Learn preview
docs/developer-tools/devflow/blazor-cdp.md Learn preview

Build report

  • Each shipped CLI process takes a 10-second mutation lease with its own ID, so a mutating WebView command run within about 10 seconds of another fails with 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.

…w network alias references

Fixes #3584 and #3590.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jfversluis
jfversluis requested a review from a team as a code owner November 27, 2026 12:49
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:49
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit ecab3b5:

✅ Validation status: passed

File Status Preview URL Details
docs/developer-tools/devflow/agent-api.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/agent-client.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/blazor-cdp.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/mcp-tools.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 0e878dc:

✅ Validation status: passed

File Status Preview URL Details
docs/developer-tools/devflow/agent-api.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/agent-client.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/blazor-cdp.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/mcp-tools.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

jfversluis added a commit that referenced this pull request Nov 27, 2026
… 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>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 9d09835:

✅ Validation status: passed

File Status Preview URL Details
docs/developer-tools/devflow/agent-api.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/agent-client.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/blazor-cdp.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/mcp-tools.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit d00c973:

✅ Validation status: passed

File Status Preview URL Details
docs/developer-tools/devflow/agent-api.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/agent-client.md ✅Succeeded View (>=net-maui-8.0)
docs/developer-tools/devflow/blazor-cdp.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants