Kiln compiles .NET WPF applications ahead of time into native Windows executables that run without an installed .NET runtime. It is written in Rust.
Experimental and paused. Nothing ships with Kiln. Voidstrap still publishes with the normal .NET SDK and the Rust
voidlauncher, which installs the .NET runtime when it is missing. Work here continues later. The current work and TODO sections record where it stopped and what is left.
- Native startup and memory use on par with or better than NativeAOT.
- Works with WPF applications as they are. No changes to XAML, bindings or application code, and no AOT annotations.
- Never crashes where NativeAOT would. Code that can be proven ahead of time is compiled to native code. Code that only exists at runtime, such as reflection driven XAML loading, dynamic bindings and generated code, runs on an embedded fallback instead of failing.
- Drop in use: reference Kiln from a WPF project and publish as usual.
The assembly reader is complete:
- PE and CLI headers, including ReadyToRun images and mixed mode assemblies
- All 45 ECMA-335 metadata tables, coded indexes, and the string, user string, blob and GUID heaps
- Method bodies, exception clauses and the full IL instruction set, decoded without allocation
- A structural verifier that checks every branch target, exception clause and token
kiln inspect <assembly or folder>... decodes and verifies every method body it finds.
The reachability analysis understands WPF:
- Reads embedded
.g.resourcesfiles and decodes every BAML record, including WPF's built in known types, which are read from PresentationFramework itself - Follows calls, constructions, fields, generic instantiations, interfaces, virtual overrides, custom attributes and module initializers from the entry point, and into the BAML of every library it reaches
- Keeps types used through reflection: everything named by BAML,
typeofand type name strings passed to reflection APIs, and types activated through generic methods such as dependency injection registration - Reports the methods whose reflection cannot be resolved ahead of time, which are left to the fallback
kiln reach <application> <folder>... prints the result, kiln reach-methods lists every reachable method and kiln baml lists the types each BAML document creates.
The fallback runs code that is not compiled ahead of time:
- An IL interpreter that shares the heap, type records, statics, string literals and garbage collector with compiled code
- Exception handling with catch, filter, finally and fault clauses, virtual and interface dispatch, delegates, boxing and static constructors
- Struct values in locals, arguments, fields, statics, arrays and boxes, with exact CoreCLR layouts and garbage collector reference maps for embedded references
- Generic classes, structs, interfaces and methods, with exact layouts, statics, static constructors and virtual tables per instantiation, including static abstract interface members
- Platform invoke into any Windows library, with primitives, pointers, byrefs,
bool, Unicode, ANSI and UTF-8 strings, blittable arrays, structs by value,SafeHandle,HandleRef, delegates, the commonMarshalAsforms,SetLastError, and native versions of the runtime QCalls ordinary code reaches - Native code calls back into managed code through generated entry stubs, for
UnmanagedCallersOnlyfunction pointers and for delegates passed to native code - Globalization through the Windows NLS APIs, so culture aware comparison, casing, number and date formatting work without ICU
- GC handles, dependent handles, locks and identity hash codes, so
ConditionalWeakTable,GCHandleandlockwork as they do in .NET - Native versions of runtime intrinsics, such as math through the Windows C runtime, interlocked operations and string resources read from each assembly
- Compiled code and the fallback call each other freely: calls to methods that are not compiled go through generated stubs, and a fault or exception unwinds compiled frames back to the fallback
- Compiled code checks array bounds, casts, overflow and null receivers, and turns hardware faults into the matching .NET exceptions
kiln fallback-report <application> <folder>... shows how much of an application the fallback can load and what still blocks the rest.
Applications run without an installed .NET runtime:
kiln run <application> <folder>... [-- arguments]runs an application's entry point on Kiln, passing itsruntimeconfig.jsonproperties toAppContextkiln publish <application> <folder>... -o <output.exe>compiles the reachable methods to x64 ahead of time and writes one Windows executable holding the Kiln runtime, the compiled code and the assemblies the application uses, next to the native libraries it importsmsbuild/Kiln.targetsrunskiln publishafterdotnet publish -r win-x64 --self-contained -p:PublishKiln=trueand writes the executable to thenativefolder of the publish directory
The fallback also runs threads and the thread pool (a global interpreter lock released around native calls, waits and every 16k interpreted instructions), monitors, type initialization gates across threads, multi dimensional arrays, UnsafeAccessor, COM wrappers in both directions, COM class activation and most of the reflection object model.
Console applications run today. Voidstrap packages into a 203 MB executable (120,121 of 269,896 reachable methods compiled to x64, the rest on the fallback) and opens its launch menu, the About window and the JumpList without an installed .NET runtime. Reaching the menu takes about 50 seconds, against well under a second on .NET.
Diagnostics are switched on with environment variables:
| Variable | Effect |
|---|---|
KILN_LOG=<file> |
Writes unsupported features, throws, COM refusals and faults with the managed stack |
KILN_TRACE=1 |
Prints a fault report with a native backtrace |
KILN_CALLS=1 |
Prints every managed and native call, indented by depth and prefixed with the thread id |
KILN_TIMING=1 |
Prints phase timings and counters on exit |
KILN_PROFILE=1 |
Samples the main thread every millisecond and prints the hottest functions |
KILN_COMPILE_REPORT=1 |
Prints why each method was not compiled ahead of time |
KILN_GC_STRESS=1 |
Collects garbage on every allocation |
When work paused, these were in progress:
- The launch menu's minimize button. The 10x1
Rectangleglyph in the Wpf.Ui title bar does not draw in the layered (AllowsTransparency) menu window, but it does draw in normal windows such as About. The button, its hover state and its tooltip all work. Isolated probes of the same rectangle, the real Wpf.UiTitleBar, BAML loading and layered windows all match .NET. The cause sits somewhere between the app's window setup and the layered presentation path. - Hover feedback reported as dead across the UI. Probes show that
IsMouseOver,MouseEnter, triggers, animations and repainting of a Wpf.Ui button in a layeredWindowChromewindow all behave as on .NET. Check again in the app after the attribute usage fix below, since brokenElementNamebindings and name scopes were a likely cause. - After the attribute usage fix the app reached the menu in 53 seconds, then exited with code 1. It logged nothing and threw no managed exception. Trace it with
KILN_CALLS=1and search forShutdown,Environment::Exit,ShowDialogand the dialog's close path. - "Not responding": the window stops answering while it opens another window (About, Settings), because that work runs interpreted on the UI thread.
Fixed in the last round, each checked against .NET with a probe:
- Boxed value types dispatched through virtual tables passed the box as
thisinstead of its data, soobject.Equals(a, b)was false for boxedcharand structs. This broke WPF triggers, for example the title bar showed its Help and Maximize buttons. - Class initializers of precise (not
beforefieldinit) types now run before their platform invokes. GDI+ is started in such an initializer, so everySystem.Drawingcall failed with "GDI+ is not properly initialized". Type.GetTypeFromCLSID,Activator.CreateInstanceof COM classes throughCoCreateInstance, andType.GUIDof those types, which the WPF JumpList needs.ParseAttributeUsageAttributereturnedInheritedandAllowMultiplein swapped order, so inherited custom attributes were never found. WPF finds name scopes through the inherited[NameScopeProperty], so everyx:Name,FindNameandElementNamebinding in compiled XAML failed.
- Find why Voidstrap exits with code 1 right after "Opening menu" since the attribute usage fix
- Draw the minimize glyph in the layered launch menu window
- Confirm hover, pressed and focus visuals across every Wpf.Ui control in the real app, not only in probes
- UI Automation.
UiaCoreProviderApi.RawUiaHostProviderFromHwndonce crashed reading address 0x10 when an automation client queried the window. Screen readers and Narrator will hit this. Later runs logged refusedQueryInterfacecalls onIRawElementProviderSimpleinstead, so CCWs for automation providers need every interface UIA asks for - WIC
IStreamCCWWritecrashes when a PNG is saved throughPngBitmapEncoder - The taskbar icon is generic while the window icon shows. Check the
CreateIconIndirectpath andWM_SETICON - Hundreds of delegate
BeginInvokeandEndInvokemethods are logged as unsupported internal calls during scanning. Stop reporting methods nobody calls, or implement them as .NET does (PlatformNotSupportedException) - Every
Reflectoperation not routed in the dispatcher reports "metadata scope from outside the fallback". Make unrouted operations report their own name instead of falling intometadata_call - Cancellation paths in the app (the Roblox account check, downloads) under the fallback
- Run Voidstrap's Settings window (the main window) and every page, the Roblox web window (WebView2), and a real Roblox launch
- Rerun every probe after each change (
bx,md,rf,ua,ptr,ic,font,rr,bm,co,tb,hv,si), keep them as a regression suite, and add them to the repository with their expected .NET output - A crash dump writer for faults outside compiled code, with the managed stack, the last native call and the last instruction
- Garbage collector stress runs (
KILN_GC_STRESS) over the whole Voidstrap startup - A thread safety audit of every
RefCellin the interpreter, now that the GIL is released around native calls, waits and every 16k instructions - Finalizers and
SafeHandlerelease on shutdown -
AppDomain.ProcessExit,AppContextswitches and unhandled exception events behave as on .NET -
Environment.Exitfrom any thread - Stack overflow detection with a clean report instead of an access violation
- Out of memory handling in the allocator and the garbage collector
- Record every failed native HRESULT and
GetLastErrorvalue inKILN_LOG, with the call that produced it - Warn when managed code calls into
MethodTable,TypeHandleorMethodTableAuxiliaryDatamembers, since those read CoreCLR layouts that Kiln imitates - An exit summary: run time, interpreted and compiled call counts, fallback entries, unsupported features hit, and first chance exceptions by type
- Show hidden errors the way the app does: every first chance exception with its stack, every exception swallowed by an empty
catch, every binding error - A
kiln doctorcommand that runs an application, collects the log, and prints the first unsupported feature, the first fault and the slowest methods - Symbolized native stacks for the Kiln runtime itself (DWARF from the GNU toolchain, or a switch to MSVC and PDBs)
- Probes that compare against .NET automatically and print only the differences
- Reaching the menu takes about 50 seconds. Profile with
KILN_PROFILE=1andKILN_TIMING=1and remove the top costs one by one - Compile generic instantiations ahead of time (shared canonical code plus exact instantiations for value types)
- Compile methods that use structs by value, exception handling, thread statics and
calli - Compile methods only reached through BAML, reflection and delegates when the target is known ahead of time
- Precompute type layouts, virtual tables, interface maps and static bases at publish time and store them in the executable
- Parse BAML and resource dictionaries at publish time
- Freeze objects created by static constructors without side effects (strings, arrays, lookup tables) into the image
- Replace per call
HashMaplookups in the interpreter with indexed tables, and add inline caches for calls, fields and casts - Decode IL once into a compact threaded form instead of decoding each instruction every time it runs
- A faster hasher (
FxHashorahash) for every interpreter map - Tiered execution: interpret first, then compile hot methods at runtime with the existing code generator
- A real register allocator and SSA optimizations (inlining, constant folding, bounds check removal, devirtualization)
- Vector intrinsics (
Vector128, SSE2, AVX2) in compiled code and the fallback, so span and string helpers stop running scalar loops - A generational collector, or at least a faster allocator, with card marking for compiled code
- Show the first window before loading assemblies it does not need
- Measure memory use against .NET and NativeAOT, and keep it lower
- Keep the UI thread responsive: never hold the GIL across long native calls, and yield more often in long interpreted loops
-
Reflection.Emit,DynamicMethodandExpression.Compile(run expression trees through the interpreter instead) -
System.Text.Json, both source generated and reflection based, over the whole Voidstrap settings model -
HttpClient,SslStreamand sockets under load, including cancellation and the thread pool's I/O completion port - WebView2, its COM interfaces and its callbacks
- Windows Runtime projections from CsWinRT
- Full RCW and CCW support for every COM interface that WPF, WIC, DirectWrite, UIA, TSF and the shell use, including aggregation and
IDispatch -
Type.GetTypeFromProgIDand the other COM lookup helpers - Multi dimensional arrays with non zero lower bounds
-
TypedReference,__arglistand varargs - Function pointers to generic methods, and
ldvirtftnon generic virtual methods - Every remaining runtime QCall and FCall that
kiln fallback-reportlists for Voidstrap -
EventSourceandNativeRuntimeEventSourceas no ops that never throw - Culture data without ICU for every culture Voidstrap ships translations for, including right to left languages and Thai, Chinese and Japanese text
- Satellite assemblies and manifest resources read from the packaged executable
- Shrink the executable: drop unreached assemblies and methods, compress the packaged assemblies, deduplicate string literals
- Sign the executable, and check it against Windows Defender and SmartScreen before any release
- Hook
kiln publishintopublish-all.ps1and the Windows release workflow behind an opt in switch. Only removevoidlauncheronce Kiln builds pass every check above - An upgrade path that copies the Kiln runtime files together with the executable (the in app upgrade copies only the exe today)
- Crash reports from users with enough detail to reproduce without a debugger
- Run the .NET runtime's own IL test suites (
src/tests/JIT,src/tests/Loader) on Kiln - Run WPF's own tests and the Wpf.Ui gallery
- Run the probe suite in CI on every change
- Fuzz the metadata reader and the IL decoder
- Type system: signatures, generics, type layout and member resolution across assemblies
- IL to SSA intermediate representation
- x64 code generation
- Runtime: garbage collector, exception handling, type loader and interop
- Reachability analysis that understands XAML and BAML
- Fallback execution for code that cannot be compiled ahead of time
- Standalone executables and MSBuild integration for
dotnet publish - Reflection object model: assemblies, modules, members and manifest resources
- Running real WPF applications end to end (Voidstrap as the target)
- Startup speed beyond NativeAOT
- Opt in use in Voidstrap's Windows release, replacing
voidlauncher
cargo build --release