Testing and troubleshooting
WebView2 inspection in WinForms
When a .NET debugger is attached to the host application, right-click menus and WebView2 developer tools (including Inspect) are enabled. The control checks the debugger state during initialization and when its browser regains focus. Native spelling/editing menus remain available in release builds; developer tools are disabled without an attached debugger.
Build and package
The build also launches the ASP.NET sample from its project directory with ASPNETCORE_ENVIRONMENT=Development, matching Visual Studio's startup environment. To repeat that regression check independently, run dotnet build samples/CODE.Editor.Sample.AspNetCore -c Debug, then ./build/test-aspnet.ps1. A physical project-local wwwroot is unnecessary: the shared distribution is copied into the output/published wwwroot, and the sample uses its explicit file provider. Rebuilding removes obsolete SDK runtime asset manifests from earlier sample builds.
From the repository root:
./build/build.ps1
This generates assets, validates documentation/paths, runs Node tests, builds CODE.Editor.sln in Release, creates the NuGet package, restores a separate package-only consumer into an isolated cache, builds/runs that consumer, and runs browser fixtures/sample initialization in WebView2. The local package cache is refreshed before each consumer restore so a rebuilt preview package cannot silently reuse an older DLL. Nothing is published. Use -SkipNative when native execution is unavailable; that skips native/browser execution explicitly, while still building the package consumer.
Requirements: Node.js, stable .NET 10 SDK and access to nuget.org for WebView2. Native execution also requires Windows Desktop runtime and WebView2. No JavaScript dependencies or bundler installation are required. The optional artifacts/dotnet SDK takes precedence over PATH. Direct repository project builds need generated assets first.
Individual commands:
node build/assets.cjs
node build/validate.cjs
node --test tests/web/*.test.cjs
dotnet build CODE.Editor.sln -c Release -m:1
dotnet pack src/CODE.Editor.WinForms/CODE.Editor.WinForms.csproj -c Release --no-build -o artifacts/packages
node build/serve.cjs
Browser fixtures are at http://127.0.0.1:8091/tests/web/browser-checks.html, feature-browser-checks.html and interaction-browser-checks.html in the same folder. The build runs these pages in a local WebView2 harness, exercising DOM selection, iframe layout and pointer/keyboard dispatch. These are synthetic fixtures, not real IME/device acceptance.
The package consumer has a PackageReference and no library ProjectReference. Its NuGet.Config maps CODE.Editor.WinForms exclusively to artifacts/packages. All referenced HTML/JS/CSS resources are read from the packaged assembly, then its editor initializes and runs bridge regression checks. Browser fixtures run separately from this isolated consumer check.
Verified migration results
The native focus regression can be run with ./build/build.ps1 -FocusChecks. It uses visible test windows and briefly switches activation, so run it when it will not interrupt other typing. Its assertions cover WinForms Tab/Shift+Tab routing, native/DOM focus, selected-text replacement after window reactivation, internal search, sibling native controls, and backward Visual selections. This automates the activation transitions; real Alt+Tab keyboard testing remains useful on target Windows/WebView2 versions.
- Before migration: 100/100 existing Node checks passed.
- After migration: 108 Node checks, focused on original behavior, confirmed defects, manifest initialization and generated asset references.
- Release solution, library and WinForms/ASP.NET Core samples: builds succeeded with zero warnings/errors.
- Package-only native consumer: 28 assertions covering editor initialization, every shell resource, Unicode/CRLF, explicit source formatting, optional/stale revisions, empty clipboard and JavaScript wire round trip verified. Exact assertions are recorded in artifacts/verification/package-consumer.json.
- WebView2 browser suites: 15/15 input/selection, 8/8 structured editing and 14/14 interaction/preview checks passed.
- Source demo, generated distribution and one-file demo: each initialized in WebView2.
- Published ASP.NET sample: shared index and runtime asset returned successfully over HTTP.
Logs and JSON results are under artifacts/verification. Historical counts in docs/history and tests/fixtures describe earlier deliveries and are not current acceptance evidence. The automated legacy input fixtures were repaired to address text children inside decoration spans rather than assigning data to an element.
Outputs and deployment
The extension/review implementation adds model checks for atomic values, multiple triggers, heading-rule coexistence, stale/cancelled actions, comment mapping, proposals, cross-view package round trips, external reconciliation, asynchronous image resolution and portable SHA-256. extension-browser-checks.html adds eight rendered checks covering menus, selection/copy, safe suggestion HTML, language controls, markup and image previews. The native consumer also exercises typed suggestion/action events and review save/load. Use --extension-checks <result-json> on the packaged consumer to run these native contracts independently when another application holds the Windows clipboard; default consumer mode still runs the real clipboard checks.
The latest extension results are recorded under artifacts/verification/editorial-native.json and editorial-browser.json. The rendered suite also captures the two editorial documentation PNGs. These checks do not replace real screen-reader/mobile/IME or multi-user editorial acceptance.
The 20 October extension verification passed 134 Node tests, 45 rendered browser checks, 38 package-only native extension assertions, 18 WinForms sample smoke assertions and three ASP.NET Development HTTP checks. The Release solution built with zero warnings/errors. The separate final real-Windows-clipboard run stopped before clipboard assertions because Clipboard.GetDataObject() returned 0x800401D0; that historical rerun was unverified, rather than counted as a pass. The subsequent follow-up rerun succeeded, as recorded below. Rendered synthetic copy checks for chip values and code toolbars passed. The clipboard failure report is preserved in artifacts/verification/editorial-clipboard-final.json.
- artifacts/browser: flat shared runtime, sample page and CODE.Editor.Demo.html.
- artifacts/packages/CODE.Editor.WinForms.0.4.0-preview.2.nupkg: self-contained editor assembly plus WebView2 dependency metadata.
- artifacts/backup: pre-migration source ZIP, SHA256 inventory and copy comparisons.
- artifacts/verification: build logs and actual test results.
ASP.NET Core consumes the generated browser distribution and includes it in published wwwroot. Photino consumes the same distribution in an existing host; no runnable Photino application is claimed. Consumers of the WinForms NuGet package need no repository, Node.js, loose editor files or editor-asset download. License approval/publication metadata remain an owner release decision; no license is invented.
Acceptance scenarios still needed
- Real IME composition: CJK input, accents/dead keys, mobile prediction, undo after composition, switching focus mid-composition.
- Accessibility: screen-reader reading order and editing; headings/lists/tables; high contrast; focus escape; divider labels.
- Mobile: iOS Safari and Android Chrome with real on-screen keyboards, touch selection, scrolling and viewport changes.
- Cross-application clipboard: Word, Outlook, browsers and spreadsheet tables; mixed HTML/text/image items; real paste/drop gestures.
- Photino: actual bridge callbacks, lifecycle, image transport, native web engines and platform differences.
- Document corpus: real Olympus notes, long SQL lines, nested lists, table escaping, unsupported HTML, malformed Markdown, mixed line endings and Unicode boundaries.
- Deployment: clean Windows machine, package-only consumer, chosen architecture/runtime, writable profile/assets, offline startup and controlled failure recovery.
Troubleshooting
| Symptom | Likely cause / action |
|---|---|
| Blank or noneditable browser area | Check the asset manifest order, load the public editor.js last, verify element dimensions and browser console |
| Surface exists but no preview | Provide iframe, call setPreviewVisible(true), and size sibling panes correctly |
| Images not visible though URL is saved | Check image origins/CSP and whether the URL is reachable in this host |
| Paste/drop image reports missing handler | Supply onImageImport or ImageImportRequested Result task |
| Save blocked by images | Inspect pending/failed items; retry or remove before snapshot |
| Save blocked after Preserve import | Preserve retains unsupported source but diagnostics still prevent validated save |
| “Finish composition” error | Wait for native text composition to commit; do not force a view/load during it |
| EditorText differs from very recent editing | It is a synchronous cache; await committed retrieval/snapshot and handle unresolved content |
| Setting a property did not take effect | Await queue/error handling; invalid browser-side configuration can leave desired and accepted state different |
| Source SQL/JS edits are being parsed as Markdown | Choose PlainText storage as well as source language |
| Native JavaScript comment toggle is a no-op | Verify PlainText storage, JavaScript language and Source mode; the native wire mapping is javascript |
| ReplaceRangeAsync rejects even without edits | An omitted revision is unguarded; explicit stale guards reject. Capture a fresh snapshot for delayed edits |
| Preview hook changes are missing | Assign async Result synchronously, or return a Promise in JS; call RefreshPreview when only external data/hook changed |
| Old async preview appears to finish late | Obsolete results are ignored; ensure host cancellation is honored to avoid wasted work |
| Preview CSS cannot load a font/stylesheet | CSP intentionally blocks arbitrary remote resources; use stylesheet text and available fonts |
| Custom preview does not align line-for-line | Changed/custom output has proportional following, not a source map |
| Font selection changes the wrong thing | Distinguish DisplayFontFamily from SetContentFontAsync |
| Ctrl+F does nothing in custom web host | Bare component emits shortcut; host must provide find UI |
| Ctrl+G has no native popup | Implement host dialog and call GoToLineAsync |
| Search Replace All unavailable in Visual | Current implementation is Source-only |
| Selection/bookmark fails after load | Loads invalidate history/bookmarks; obtain new state |
| WebView2 initialization fails | Verify runtime/dependencies/profile directory and capture EditorError |
WebView2 reports 0x8007139F |
A shared browser profile may already be in use with incompatible environment settings. Set UserDataFolder to an application-specific writable directory before initialization, or close instances sharing that folder and restart. The WinForms sample uses its own profile, separate from other consumers. |
| WindowsBase reference-conflict build warning in a WinForms-only consumer | WebView2's transitive package also adds its WPF assembly; use the targeted unused-WPF-reference removal shown in the WinForms quick start |
| Unexpected native browser failure | Save/recover from application state and recreate control; automatic crash recovery is not implemented |
Reporting a reproducible problem
Capture the package/source revision, host/browser/runtime, format/view/language, effective policy, minimal input string, exact keystrokes/commands, and expected versus actual result. Include revision/session and diagnostics where relevant. Remove private document contents from shared logs.
Use the smallest fixture that exercises the real boundary. A pure model problem belongs in Node tests; selection/IME/scroll bugs need browser interaction; .NET queue/enum/event bugs need bridge/native coverage. Do not replace real input acceptance with tests that merely restate a helper's implementation.
Documentation checks
The manual is split into a main index and 23 topic files. The build validates local Markdown links and source HTML asset references; executable behavior is verified by the Node, browser and native suites. Documentation/path validation does not count as runtime acceptance.
The October 20 follow-up suite adds followups.test.cjs, followup-browser-checks.html and a reproducible long-document-benchmark.js. It covers 10,000-line loading/repeated paste, fence/line-break preservation, image clipboard/move/resize interactions, Source review decorations and aligned comment cards. The package-only consumer also checks the new typed image/annotation APIs. See chapter 20 for measured timings and the distinction between DOM clipboard checks and native external interoperability.
Final follow-up results: 149 Node tests, 56 rendered WebView2 checks, 61 package-only native assertions including real Windows clipboard, 18 WinForms sample smoke assertions and three ASP.NET startup checks passed; Release builds had zero warnings/errors. The real clipboard run verified Source/Visual Ctrl+C/Ctrl+V/Ctrl+X, HTML formatting, image CopyAsync/PasteAsync with dimensions, UTF-8 fragment offsets and undo. It supersedes the earlier clipboard-session blockage, without claiming external Word/Outlook validation. Evidence: artifacts/followup-clipboard.json, artifacts/followup-rendered.json, artifacts/followup-sample.json and artifacts/verification/aspnet-development-checks.json. New documentation screenshots were rendered and visually inspected.
Review UI/theming verification adds review-ui.test.cjs and review-ui-browser-checks.html: safe connector routes/fallback, Source/Visual toggles, overlapping-thread chooser/keyboard behavior, reply-draft preservation, collapsed-margin space, large-font/narrow layouts, per-instance portal CSS, palette/reset, disposal and bare defaults. The package consumer also covers the typed theme/presentation APIs and notifications. The showcase is loaded in the browser harness and emulates forced colors/reduced motion. These synthetic checks do not establish screen-reader or mobile-device acceptance.
ED-018–ED-022 verification: 155 Node checks, 69 rendered browser checks (plus two-editor initialization/palette and forced-color checks), 71 isolated package-only native assertions including real clipboard/theme rollback, 18 sample smoke assertions and six ASP.NET HTTP checks passed. Release solution/consumer builds have zero warnings/errors. Evidence is in artifacts/review-ui-rendered.json, artifacts/review-ui-clipboard.json, artifacts/review-ui-sample.json and artifacts/verification/aspnet-development-checks.json. The default/plum showcase and updated Source review images were inspected. Styling and comment bubble guide.
UI wording and scrollbar follow-up
The 20 October 2026 localization/marker follow-up passes 162 Node tests, 75 rendered checks, 64 final fresh-package native assertions (including localization rollback), 18 sample checks and seven ASP.NET HTTP checks. The suite exercises live wording changes without draft/focus loss, per-instance isolation, text-safe substitution, plural forms, native search labels, dictionary reset and marker/badge clearance from scrollbar geometry. See artifacts/localization-browser.json, artifacts/localization-native.json and localization. The clipboard harness attempts to restore saved contents. An earlier 78-assertion run passed, but a final rerun hit Windows 0x800401D4 during restoration; clipboard contents may have changed. No further clipboard runs were attempted. Evidence: artifacts/localization-clipboard-restore-error.json. Platform-specific overlay scrollbar gestures and real screen-reader/mobile acceptance remain separate.
Reference-style default visuals
The editorial visual refresh passes 162 Node tests, 76 rendered browser checks, 64 package-only native checks without clipboard access, 18 WinForms sample checks and seven ASP.NET HTTP checks. The rendered suite covers persistent pins, connector hover/focus entry and exit, shared comment accent variables, source/visual geometry, compact headers, localization, safe routes and theme isolation. The default reference-style screenshot and the existing documentation screenshots were captured and inspected. Evidence: artifacts/design-browser.json, artifacts/design-native.json, artifacts/design-sample.json, artifacts/design-node.txt and artifacts/design-build.txt.
The code-anchor/independent-scroll follow-up passes 162 Node tests, 78 rendered browser checks, 64 fresh-package native checks without clipboard access, 18 WinForms sample checks and seven ASP.NET HTTP checks. New rendered cases check exact code-word glyphs and pin-to-card endpoints in Source/Visual, retention of offscreen discussions, stable independent pane scrolling and click-to-anchor navigation. All fifteen documentation figures were regenerated from the actual samples and visually inspected; the root README now includes the web feature overview. Evidence: artifacts/review-scroll-browser.json, artifacts/review-scroll-native.json, artifacts/review-scroll-sample.json, artifacts/review-scroll-node.txt, artifacts/review-scroll-build.txt and artifacts/documentation-native.json. Documentation validation covers 41 Markdown files and source asset references.
Documentation audit: 26 October 2026
Reviewed all 23 current chapters, package setup instructions, public native options/methods/events, appearance mappings and the screenshot catalog against current source. Historical reports above and docs/history retain their original versions/counts. At that audit, setup examples followed package version 0.5.0. The language catalog contains 195 entries, including distinct HTML and XML selections.
The audit adds explicit Paragraph/inline-format reset guidance, registered-textblock actions/autocomplete/preview, review-switch API links, the missing preview event/type, complete native/browser/CSS appearance mappings, and chapters 22–23 in the main contents. Documentation validation now checks current package versions, appearance-property coverage and screenshot catalog coverage in addition to links/assets.
Validation: all 43 Markdown files and source HTML references pass documentation validation, and 213 Node tests pass. The Release solution build succeeded with three NU1900 warnings because NuGet vulnerability metadata was unavailable over the network. Four native viewport captures and thirteen browser captures were refreshed from the running samples; all seventeen images were visually inspected, including the two new snippet/textblock figures. Sample initialization, live wording toggles and the two-editor theme checks pass in the capture harness. Evidence: artifacts/documentation-node-tests.txt, artifacts/documentation-native.json and artifacts/documentation-captures.json.
The complete rendered regression suite is not green: a final fixtures-only run covered all six pages and passed 120/123 checks. Failures are the image-menu color assertion, context-menu dismissal interaction, and localization of an empty action menu. Evidence: artifacts/documentation-browser-final.json. A preceding full run also showed an intermittent snippet-toolbar focus assertion; it passed on rerun. These are verification findings, not documentation-check failures. An obsolete chip-menu selector was updated to use the current active token toolbar. Screenshot-only success does not certify those regression checks.
To refresh browser figures independently after building the package consumer, run CODE.Editor.PackageConsumer.exe --documentation-screenshots "<repository-root>" "<result-json>". The default --browser-checks path still requires all rendered fixtures to pass before capturing. Native figures use the WinForms sample executable with --documentation-screenshots "<repository-root>". Inspect refreshed figures and run node build/validate.cjs before committing.
Documentation audit: 27 October 2026
Updated setup examples to the project's 0.6.0 package version, corrected contradictory plain-text-only descriptions of native clipboard methods, and documented text-link controls, linked-image destinations/titles, image-source replacement and the Size menu. The manual index now maps important visible features to detailed guides and screenshots. The runtime localization catalog already matches the documented catalog.
All sixteen browser figures were refreshed from current generated assets, including three new captures for links, linked images and image sizing. The four native screenshots from 26 October remain in the catalog. The twenty-image contact sheet and new link figures were visually inspected. Capture code lives in tests/winforms/BrowserChecks.cs; screenshots are real sample viewports, not mockups.
Validation: 43 Markdown files and source asset references pass node build/validate.cjs; all 247 Node tests pass. The capture harness passes sample initialization, wording toggles and theme checks. Evidence: artifacts/verification/docs-2026-10-27-node.txt and artifacts/verification/docs-2026-10-27-captures.json.
The separate rendered suite passes 136/140 checks. Remaining failures concern snippet-toolbar visibility/focus, image-menu colors, context-menu dismissal and empty-action-menu localization. These were also observed in the preceding audit (the snippet assertion was intermittent). They remain unresolved runtime/test findings; this documentation update does not certify a green regression suite. Full results: artifacts/verification/docs-2026-10-27-browser.json. Native clipboard interoperability and mobile/accessibility acceptance were not rerun for this documentation task.
Screenshot expansion later in this audit adds seven more illustrated workflows: Original/Proposed review, alternate UI wording, Source image controls, snippet Actions, Visual textblocks and the dark palette. All twenty-three browser captures pass the screenshot harness; the seven new figures were visually inspected and embedded beside their instructions. The catalog now contains twenty-seven screenshots including the four native captures. Evidence: artifacts/verification/docs-more-captures.json and artifacts/verification/docs-more-contact.png. The screenshot harness builds with zero warnings/errors, and documentation validation passes. This capture-only follow-up does not change the rendered regression results above.