Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,18 @@ Conventions for contributors:
Visual Studio 2022. The build's fallback to the `Microsoft.VSSDK.BuildTools`
package targets now follows the restored package instead of a hardcoded version.

- **The `--preview` and `--preview-list` devtools flags are removed (issue #1819).** They were
renamed before the first public preview, and every published package already accepts the new
names. Use `--devtools run [Component]` for `--preview [Component]` and `--devtools list
[file]` for `--preview-list [file]`. The other switches (`--vscode`, `--fps`, `--width`,
`--height`, `--x`, `--y`) work the same after `--devtools run`. An app started with
`--preview` now runs as a normal launch with no devtools. The
`DevtoolsCliOptions.UsedDeprecatedPreview` and `PreviewAndDevtoolsConflict` positional
parameters go with them, so update `Microsoft.UI.Reactor.Devtools` to the same version as
`Microsoft.UI.Reactor`. The VS Code extension no longer falls back to `--preview --vscode`
for pre-rename Reactor packages and no longer logs the `reactor_preview_launch` telemetry
event, and the docs screenshot pipeline launches doc apps with `--devtools run --vscode`.

### Fixed

- **A `Border`'s `BorderBrush` and a `Canvas`'s `Background` no longer lose their brush on an
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Reactor spans a core framework and a set of higher-level features. Each area bel
| **Shell integration** | Taskbar progress and overlays, jump lists, tray icons, thumbnail toolbars, layered-window hosting (opacity, no-activate, click-through) | Early |
| **Win2D canvas** | Optional `Reactor.Advanced` package — immediate-mode GPU drawing via `Win2DCanvas` / `Win2DAnimatedCanvas` / `Win2DVirtualCanvas` and draw-state hooks | Early |
| **Control wrapper generator** | Source generator that turns WinUI controls into Reactor elements via `[GenerateReactorWrapper]` — auto factory methods, descriptors, two-way props | Early |
| **Preview / hot reload** | `MetadataUpdateHandler` hot reload, CLI `--preview` flag, VS Code live preview | Early |
| **Preview / hot reload** | `MetadataUpdateHandler` hot reload, CLI `--devtools` flag, VS Code live preview | Early |
| **Visual Studio embedded preview** | Experimental VSIX that reparents a live WinUI app into a Visual Studio tool window | Experimental / roughest |

> Maturity labels reflect the breadth of testing and the likelihood of API churn, not feature completeness. *Preview* areas have the broadest unit and selftest coverage (plus end-to-end tests where applicable) and are the most stable — pure-managed subsystems (Flex, Markdown, Commanding) lean on exhaustive unit and selftest suites where end-to-end input isn't applicable. *Draft* areas work on the golden path but may have rough edges or partial AOT support. *Early* areas are usable but expect bigger shape changes as we iterate. The Visual Studio embedded preview is intentionally called out separately: in a repository of experiments, it is currently the roughest and most experimental surface.
Expand Down Expand Up @@ -168,21 +168,17 @@ Reactor includes a built-in preview mode — mount a single component in isolati

### CLI preview

Any Reactor app that passes `preview: true` to `ReactorApp.Run` supports the `--preview` flag:

```csharp
ReactorApp.Run<App>("My App", preview: true);
```
Any Reactor app with devtools set up (see [Devtools](docs/guide/devtools.md)) supports the `--devtools` flag:

```bash
# Preview a specific component with hot reload
dotnet watch run --project MyApp -p:Platform=x64 -- --preview CounterDemo
dotnet watch run --project MyApp -p:Platform=x64 -- --devtools run CounterDemo

# Preview the first component in the project
dotnet watch run --project MyApp -p:Platform=x64 -- --preview
dotnet watch run --project MyApp -p:Platform=x64 -- --devtools run

# List available components
dotnet run --project MyApp -p:Platform=x64 -- --preview-list
dotnet run --project MyApp -p:Platform=x64 -- --devtools list
```

### VS Code extension
Expand Down
3 changes: 0 additions & 3 deletions docs/_pipeline/templates/devtools.md.dt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ dotnet run -- --devtools app
| `--devtools list [file]` | Prints the names of the app's components and exits. With a file name, it also writes the list to that file. |
| `--devtools screenshot [Component] --out shot.png` | Opens one component, saves a PNG of the window, and exits. `--out` is required. |

`--preview` is an old name for `--devtools run`. It still works, but prints a
warning.

## Set up devtools

Devtools need two things at build time: the package and a build switch.
Expand Down
2 changes: 1 addition & 1 deletion docs/_pipeline/templates/source-mapping.md.dt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tier: solid
# Source Mapping

"Source mapping" in Microsoft.UI.Reactor (Reactor) is the chain that ties a
runtime artifact — an ETW event, a `--preview` overlay highlight, a thrown
runtime artifact — an ETW event, a devtools overlay highlight, a thrown
exception — back to the C# source that produced it.

Two granularities ship today: *component* attribution, where every render
Expand Down
3 changes: 0 additions & 3 deletions docs/_pipeline/templates/vs-extension.md.dt
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ Run these from the Command Palette:
**Live** when frames arrive.
- The **Reactor Preview** output channel shows the app's output.

If the app uses an older Reactor package without devtools, the extension
starts it again with the old `--preview --vscode` flags.

## Tips

- Check the **Reactor Preview** output pane or channel first. It shows the
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/doc-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ preview host applies as the window's start position.

##### How a capture works

1. The pipeline launches the doc app with `dotnet run -- --preview --vscode` at the
1. The pipeline launches the doc app with `dotnet run -- --devtools run --vscode` at the
manifest's size. The in-app preview host (`Microsoft.UI.Reactor.Devtools`) renders the
app and switches between the manifest's components (`POST /preview`) — that part is
unchanged.
Expand Down
3 changes: 0 additions & 3 deletions docs/guide/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ dotnet run -- --devtools app
| `--devtools list [file]` | Prints the names of the app's components and exits. With a file name, it also writes the list to that file. |
| `--devtools screenshot [Component] --out shot.png` | Opens one component, saves a PNG of the window, and exits. `--out` is required. |

`--preview` is an old name for `--devtools run`. It still works, but prints a
warning.

## Set up devtools

Devtools need two things at build time: the package and a build switch.
Expand Down
22 changes: 4 additions & 18 deletions docs/guide/reference/diagnostics/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Types the developer tools use to start inside an app.

## `DevtoolsCliOptions`

Parsed result of a `--devtools` / `--preview` invocation. [`DevtoolsCliOptions.Subverb`](#subverb) is `null` when neither flag is present.
Parsed result of a `--devtools` invocation. [`DevtoolsCliOptions.Subverb`](#subverb) is `null` when the command line has no devtools verb, or when its arguments fail validation.

```csharp
public sealed record DevtoolsCliOptions(DevtoolsSubverb? Subverb, string? ComponentName, bool VsCodeMode, int Fps, string? ListOutputPath, string? ScreenshotOutputPath, int? McpPort, string? LogLevel, McpTransport Transport, bool UsedDeprecatedPreview, bool PreviewAndDevtoolsConflict, string? ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string? EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
public sealed record DevtoolsCliOptions(DevtoolsSubverb? Subverb, string? ComponentName, bool VsCodeMode, int Fps, string? ListOutputPath, string? ScreenshotOutputPath, int? McpPort, string? LogLevel, McpTransport Transport, string? ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string? EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
```

Namespace: `Microsoft.UI.Reactor.Hosting.Devtools`.
Expand All @@ -18,10 +18,10 @@ Namespace: `Microsoft.UI.Reactor.Hosting.Devtools`.

#### `DevtoolsCliOptions`

Parsed result of a `--devtools` / `--preview` invocation. [`DevtoolsCliOptions.Subverb`](#subverb) is `null` when neither flag is present.
Parsed result of a `--devtools` invocation. [`DevtoolsCliOptions.Subverb`](#subverb) is `null` when the command line has no devtools verb, or when its arguments fail validation.

```csharp
public DevtoolsCliOptions(DevtoolsSubverb? Subverb, string? ComponentName, bool VsCodeMode, int Fps, string? ListOutputPath, string? ScreenshotOutputPath, int? McpPort, string? LogLevel, McpTransport Transport, bool UsedDeprecatedPreview, bool PreviewAndDevtoolsConflict, string? ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string? EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
public DevtoolsCliOptions(DevtoolsSubverb? Subverb, string? ComponentName, bool VsCodeMode, int Fps, string? ListOutputPath, string? ScreenshotOutputPath, int? McpPort, string? LogLevel, McpTransport Transport, string? ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string? EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
```

**Parameters**
Expand All @@ -37,8 +37,6 @@ public DevtoolsCliOptions(DevtoolsSubverb? Subverb, string? ComponentName, bool
| `McpPort` | `int?` | | |
| `LogLevel` | `string?` | | |
| `Transport` | [`McpTransport`](#mcptransport) | | |
| `UsedDeprecatedPreview` | `bool` | | |
| `PreviewAndDevtoolsConflict` | `bool` | | |
| `ProjectIdentifier` | `string?` | `null` | |
| `LogsDisabled` | `bool` | `false` | |
| `LogsCapacityMb` | `int?` | `null` | |
Expand Down Expand Up @@ -126,12 +124,6 @@ public bool LogsDisabled // get, init
public int? McpPort // get, init
```

#### `PreviewAndDevtoolsConflict`

```csharp
public bool PreviewAndDevtoolsConflict // get, init
```

#### `ProjectIdentifier`

```csharp
Expand All @@ -156,12 +148,6 @@ public DevtoolsSubverb? Subverb // get, init
public McpTransport Transport // get, init
```

#### `UsedDeprecatedPreview`

```csharp
public bool UsedDeprecatedPreview // get, init
```

#### `VsCodeMode`

```csharp
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/source-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Source Mapping

"Source mapping" in Microsoft.UI.Reactor (Reactor) is the chain that ties a
runtime artifact — an ETW event, a `--preview` overlay highlight, a thrown
runtime artifact — an ETW event, a devtools overlay highlight, a thrown
exception — back to the C# source that produced it.

Two granularities ship today: *component* attribution, where every render
Expand Down
3 changes: 0 additions & 3 deletions docs/guide/vs-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ Run these from the Command Palette:
**Live** when frames arrive.
- The **Reactor Preview** output channel shows the app's output.

If the app uses an older Reactor package without devtools, the extension
starts it again with the old `--preview --vscode` flags.

## Tips

- Check the **Reactor Preview** output pane or channel first. It shows the
Expand Down
14 changes: 7 additions & 7 deletions docs/security/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This document is the high-level threat model for the Microsoft.UI.Reactor framew

Reactor is a managed-only C# framework for building WinUI 3 desktop apps. **It has no production network surface, no privilege boundary, no cross-machine reach, no kernel surface, and no secret handling.** It runs inside the consuming app's process at the consuming app's trust level.

The only sockets the framework ever opens are two **opt-in, loopback-only, bearer-token-gated dev-time HTTP servers** (`PreviewCaptureServer`, `DevtoolsMcpServer`) plus a stdio MCP variant. These are off by default in production builds; a consuming app must explicitly pass `--preview` or `--devtools` to expose them, they bind to `127.0.0.1` only, and every request is authenticated by a 256-bit per-launch random token. The dev CLI (`mur`) is developer-invoked.
The only sockets the framework ever opens are two **opt-in, loopback-only, bearer-token-gated dev-time HTTP servers** (`PreviewCaptureServer`, `DevtoolsMcpServer`) plus a stdio MCP variant. These are off by default in production builds; a consuming app must explicitly pass `--devtools` to expose them, they bind to `127.0.0.1` only, and every request is authenticated by a 256-bit per-launch random token. The dev CLI (`mur`) is developer-invoked.

There is no auto-updater, no telemetry endpoint, no license check, no crypto stored at rest, no key management, and no PKI implementation. `System.Security.Cryptography.RandomNumberGenerator` is used exclusively to generate the per-launch bearer tokens above.

Expand Down Expand Up @@ -53,7 +53,7 @@ Developer machine
| | | .Generator | | - font/glyph rendering | | |
| | +-----------------+ +-------------------------------+ | |
| | | | |
| | | (--preview / --devtools, opt-in) | |
| | | (--devtools, opt-in) | |
| | v | |
| | +----------------------------------------------------+ | |
| | | PreviewCaptureServer | DevtoolsMcpServer | | |
Expand All @@ -75,7 +75,7 @@ Developer machine
Three things to notice:

1. **Microsoft.UI.Reactor.dll runs inside the consuming app's process.** It has no separate process, no service, no daemon.
2. The dev-time HTTP servers and the `mur` CLI are *not* shipped to end users. They are developer-loop tooling; in a production app build the developer simply doesn't pass `--preview` / `--devtools` and the servers never instantiate.
2. The dev-time HTTP servers and the `mur` CLI are *not* shipped to end users. They are developer-loop tooling; in a production app build the developer simply doesn't pass `--devtools` and the servers never instantiate.
3. There is no arrow leaving the box. **There is no Reactor process that talks to the network or to another machine.**

### 4.1 Artifacts produced
Expand Down Expand Up @@ -144,8 +144,8 @@ Same shape as Boundary A: loopback-only HTTP (`http://127.0.0.1:<port>/mcp`) wit

### 7.1 Preview capture server

**File:** `src/Reactor/Hosting/PreviewCaptureServer.cs`
**Activation:** opt-in via `--preview` flag on the consuming app or via `mur preview`.
**File:** `src/Reactor.Devtools/PreviewCaptureServer.cs`
**Activation:** opt-in via `--devtools run` with `--vscode` (how the VS Code extension and the docs screenshot pipeline launch it) or with `--embed`, which turns `--vscode` on (how the Visual Studio embedded preview launches it).
**Surface:** loopback HTTP listener at `http://127.0.0.1:<random port>`.

**Endpoints:**
Expand Down Expand Up @@ -330,8 +330,8 @@ Microsoft's internal Security Assessment policy lists six trust-boundary trigger
- [`AGENTS.md`](../../AGENTS.md) — repo conventions, test tiers, AOT posture
- [`SECURITY.md`](../../SECURITY.md) — Microsoft vulnerability reporting policy
- [`ThirdPartyNoticeText.txt`](../../ThirdPartyNoticeText.txt) — OSS attributions for Yoga / md4c / D3 / WinUIEx and NuGet deps
- [`src/Reactor/Hosting/PreviewCaptureServer.cs`](../../src/Reactor/Hosting/PreviewCaptureServer.cs) — dev preview server
- [`src/Reactor/Hosting/Devtools/DevtoolsMcpServer.cs`](../../src/Reactor/Hosting/Devtools/DevtoolsMcpServer.cs) — devtools MCP server
- [`src/Reactor.Devtools/PreviewCaptureServer.cs`](../../src/Reactor.Devtools/PreviewCaptureServer.cs) — dev preview server
- [`src/Reactor.Devtools/DevtoolsMcpServer.cs`](../../src/Reactor.Devtools/DevtoolsMcpServer.cs) — devtools MCP server
- [`src/Reactor.Advanced/Markdown/MarkdownBuilder.cs`](../../src/Reactor.Advanced/Markdown/MarkdownBuilder.cs) — native `Markdown()` renderer + URL allow-list (`IsSafeUri`)
- [`tests/Reactor.Markdown.TestRenderer/MarkdownHtml.cs`](../../tests/Reactor.Markdown.TestRenderer/MarkdownHtml.cs) — test-only CommonMark/spec HTML renderer + URL sanitizer
- [`tools/install-skill-kit.ps1`](../../tools/install-skill-kit.ps1) — installer with guard-rails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1974,15 +1974,13 @@ Unmount(UnmountContext ctx, TControl control) → void
Update(UpdateContext ctx, TElement oldEl, TElement newEl, TControl ctrl) → void

### record DevtoolsCliOptions
new(DevtoolsSubverb? Subverb, string ComponentName, bool VsCodeMode, int Fps, string ListOutputPath, string ScreenshotOutputPath, int? McpPort, string LogLevel, McpTransport Transport, bool UsedDeprecatedPreview, bool PreviewAndDevtoolsConflict, string ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
new(DevtoolsSubverb? Subverb, string ComponentName, bool VsCodeMode, int Fps, string ListOutputPath, string ScreenshotOutputPath, int? McpPort, string LogLevel, McpTransport Transport, string ProjectIdentifier = null, bool LogsDisabled = false, int? LogsCapacityMb = null, bool EmbedRequested = false, WindowEmbedStyle EmbedStyle = WindowEmbedStyle.Child, int? EmbedHostPid = null, string EmbedValidationError = null, bool EmbedAutoEnabledVsCode = false, double? WindowWidth = null, double? WindowHeight = null, double? WindowX = null, double? WindowY = null)
DevtoolsSubverb? Subverb { get; init; }
McpTransport Transport { get; init; }
WindowEmbedStyle EmbedStyle { get; init; }
bool EmbedAutoEnabledVsCode { get; init; }
bool EmbedRequested { get; init; }
bool LogsDisabled { get; init; }
bool PreviewAndDevtoolsConflict { get; init; }
bool UsedDeprecatedPreview { get; init; }
bool VsCodeMode { get; init; }
double? WindowHeight { get; init; }
double? WindowWidth { get; init; }
Expand All @@ -1998,7 +1996,7 @@ string ListOutputPath { get; init; }
string LogLevel { get; init; }
string ProjectIdentifier { get; init; }
string ScreenshotOutputPath { get; init; }
Deconstruct(ref DevtoolsSubverb? Subverb, ref string ComponentName, ref bool VsCodeMode, ref int Fps, ref string ListOutputPath, ref string ScreenshotOutputPath, ref int? McpPort, ref string LogLevel, ref McpTransport Transport, ref bool UsedDeprecatedPreview, ref bool PreviewAndDevtoolsConflict, ref string ProjectIdentifier, ref bool LogsDisabled, ref int? LogsCapacityMb, ref bool EmbedRequested, ref WindowEmbedStyle EmbedStyle, ref int? EmbedHostPid, ref string EmbedValidationError, ref bool EmbedAutoEnabledVsCode, ref double? WindowWidth, ref double? WindowHeight, ref double? WindowX, ref double? WindowY) → void
Deconstruct(ref DevtoolsSubverb? Subverb, ref string ComponentName, ref bool VsCodeMode, ref int Fps, ref string ListOutputPath, ref string ScreenshotOutputPath, ref int? McpPort, ref string LogLevel, ref McpTransport Transport, ref string ProjectIdentifier, ref bool LogsDisabled, ref int? LogsCapacityMb, ref bool EmbedRequested, ref WindowEmbedStyle EmbedStyle, ref int? EmbedHostPid, ref string EmbedValidationError, ref bool EmbedAutoEnabledVsCode, ref double? WindowWidth, ref double? WindowHeight, ref double? WindowX, ref double? WindowY) → void
Equals(DevtoolsCliOptions other) → bool
Equals(object obj) → bool
GetHashCode() → int
Expand Down
Loading
Loading