Skip to content

Instantly share code, notes, and snippets.

View kennykerr's full-sized avatar

Kenny Kerr kennykerr

View GitHub Profile

Simplifying the windows-reactor Programming Model

A cross-language comparison of common UI patterns in React, C# (Microsoft.UI.Reactor), and Rust (windows-reactor), followed by concrete proposals to reduce boilerplate and friction in the Rust version — while remaining idiomatically Rust.


The Clone Tax

The problem in three languages

Reactor Framework Comparison

A comparison of four declarative, component-based UI frameworks — the original React (the progenitor) and three reactor-style frameworks sharing the same conceptual lineage: declarative UI with reconciliation.

The goal is not to clone React, but to understand where the state of the art is heading and what ideas can benefit windows-reactor in a Rust/WinUI context.

React windows-reactor Microsoft.UI.Reactor MauiReactor
Repo facebook/react microsoft/windows-rs microsoft/microsoft-ui-reactor adospace/reactorui-maui
Language JavaScript / TypeScript Rust C# C#
extras
Microsoft.UI.Xaml.DependencyObject
Microsoft.UI.Xaml.UIElement
Microsoft.UI.Xaml.FrameworkElement
Microsoft.UI.Xaml.RoutedEventHandler
Microsoft.UI.Xaml.HorizontalAlignment
Microsoft.UI.Xaml.VerticalAlignment
Microsoft.UI.Xaml.TextWrapping
Microsoft.UI.Xaml.ElementTheme
Microsoft.UI.Xaml.Thickness
fn main() {
windows_rdl::Reader::new()
.input("crates/tools/bindings/src/extras.rdl")
.input("winmd/Windows.Win32.winmd")
.output("winmd/extras.winmd")
.write()
.unwrap();
let args = [
"--in",

Upstream proposal: method-level entries in --filter

Design note to file against microsoft/windows-rs. No code changes in this repo yet — the work depends on bindgen-side support landing first.

Motivation

Type-level --filter in crates/tools/bindings/src/main.rs is at its empirical minimum (see the bindings filter memory: every entry is reachable from code we actually use). Despite that, crates/libs/reactor/src/bindings.rs

Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.26s
Running `target\debug\theme.exe`
[theme-sample] starting (WINDOWS_REACTOR_THEME_TRACE=ON). To capture a verbose trace for a bug report, set WINDOWS_REACTOR_THEME_TRACE=1 before running and redirect stderr to a file (PowerShell: `$env:WINDOWS_REACTOR_THEME_TRACE='1'; cargo run -p theme 2> theme.log`).
windows_reactor: diagnostics armed (panic hook; crash log → C:\Users\kekerr\AppData\Local\Temp\windows-reactor-crash-36936.log)
[theme + 0ms] use_color_scheme -> Light (cell_present=true)
[theme + 0ms] reconciler::reconcile ENTRY force_rerender=false color_scheme=Light
[theme + 10ms] reconciler::reconcile EXIT (clearing force_component_rerender from false)
[theme + 138ms] subscribe_actual_theme_changed initial seed ActualTheme=ElementTheme(2) -> Dark
[theme + 138ms] reconciler::notify_theme_changed CHANGED Light -> Dark (force_component_rerender=true)
[theme + 204ms] use_color_scheme -> Dark (cell_present=true)
Compiling windows-reactor v0.0.0 (D:\git\windows-reactor-rs\crates\libs\reactor)
Compiling showcase v0.0.0 (D:\git\windows-reactor-rs\crates\samples\showcase)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.50s
Running `target\debug\showcase.exe`
windows_reactor: diagnostics armed (panic hook + VEH + SEH filter; crash log → C:\Users\kekerr\AppData\Local\Temp\windows-reactor-crash-31448.log)
thread 'main' (34912) panicked at crates\libs\reactor\src\winui\backend.rs:1742:22:
UIElementCollection.SetAt: Error { code: HRESULT(0x800F1000), message: "Element is already the
Removed 664 files, 392.7MiB total
Compiling proc-macro2 v1.0.106
Compiling quote v1.0.45
Compiling unicode-ident v1.0.24
Compiling windows-link v0.2.1 (https://github.com/microsoft/windows-rs?rev=e176d92b82fbdd7678175d6d215c831069167761#e176d92b)
Compiling pulldown-cmark v0.10.3
Compiling memchr v2.8.0
Compiling windows-reactor v0.0.0 (D:\git\windows-reactor-rs\crates\libs\reactor)
Compiling bitflags v2.11.1
Compiling unicase v2.9.0
Removed 697 files, 404.8MiB total
Compiling proc-macro2 v1.0.106
Compiling quote v1.0.45
Compiling unicode-ident v1.0.24
Compiling windows-link v0.2.1 (https://github.com/microsoft/windows-rs?rev=e176d92b82fbdd7678175d6d215c831069167761#e176d92b)
Compiling pulldown-cmark v0.10.3
Compiling bitflags v2.11.1
Compiling windows-reactor v0.0.0 (D:\git\windows-reactor-rs\crates\libs\reactor)
Compiling memchr v2.8.0
Compiling unicase v2.9.0
Compiling windows-reactor v0.0.0 (D:\git\windows-reactor-rs\crates\libs\reactor)
Compiling showcase v0.0.0 (D:\git\windows-reactor-rs\crates\samples\showcase)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.14s
Running `target\debug\showcase.exe`
windows_reactor: diagnostics armed (panic hook + VEH + SEH filter; crash log → C:\Users\kekerr\AppData\Local\Temp\windows-reactor-crash-7496.log)
thread 'main' (33428) panicked at crates\libs\reactor\src\winui\backend.rs:1637:22:
UIElementCollection.SetAt: Error { code: HRESULT(0x800F1000), message: "Element is already the c