AvaloniaUI.DiagnosticsSupport.HotReload 1.0.1

Prefix Reserved
dotnet add package AvaloniaUI.DiagnosticsSupport.HotReload --version 1.0.1
                    
NuGet\Install-Package AvaloniaUI.DiagnosticsSupport.HotReload -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AvaloniaUI.DiagnosticsSupport.HotReload" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport.HotReload" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="AvaloniaUI.DiagnosticsSupport.HotReload" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AvaloniaUI.DiagnosticsSupport.HotReload --version 1.0.1
                    
#r "nuget: AvaloniaUI.DiagnosticsSupport.HotReload, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AvaloniaUI.DiagnosticsSupport.HotReload@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AvaloniaUI.DiagnosticsSupport.HotReload&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=AvaloniaUI.DiagnosticsSupport.HotReload&version=1.0.1
                    
Install as a Cake Tool

AvaloniaUI.DiagnosticsSupport.HotReload

XAML and C# hot reload for Avalonia applications.

What it does

When your application is running under the .NET Hot Reload pipeline, edits to .axaml and .cs files are applied live:

  • Controls (files with x:Class) — the old and new XAML are diffed and only the changed portions of live instances are patched: an attribute edit becomes a single property assignment, adding/removing an element rebuilds only that subtree, and wrapping/unwrapping moves the live controls instead of recreating them. Runtime state (text input, selection, scroll position, view models, event wiring) survives because the controls holding it are never destroyed. Edits the differ cannot express fall back to rebuilding the instance in place, preserving state where possible.
  • Styles — application- and control-level styles are re-applied so selector and setter changes take effect immediately.
  • Resource dictionaries — merged dictionaries are reloaded and dependents are refreshed.
  • Data templates — templates are regenerated and controls bound to them are refreshed.
  • {StaticResource} rewriting — by default, {StaticResource ...} references are rewritten to {DynamicResource ...} during hot reload so resource edits propagate without having to restart.

A file-system fallback watcher can also pick up .axaml edits when the .NET Hot Reload agent is not available.

Installation

Add the package to your Avalonia application project:

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
  <PackageReference Include="AvaloniaUI.DiagnosticsSupport.HotReload" Version="..." />
</ItemGroup>

Licensing

AvaloniaUI.DiagnosticsSupport.HotReload is a licensed library. A valid runtime license key covering the AvaloniaUI.DiagnosticsSupport.HotReload product must be present at build time, or initialization will throw AvaloniaLicensingException the first time hot reload activates.

Add your key in the application's .csproj:

<ItemGroup>
  <AvaloniaUILicenseKey Include="$(AvaloniaUILicenseKey)" />
</ItemGroup>

…and supply the key value as an MSBuild property, environment variable, or through your CI secret store, e.g.:

<PropertyGroup>
  <AvaloniaUILicenseKey>...your runtime license key...</AvaloniaUILicenseKey>
</PropertyGroup>

The same key may already be configured for other licensed AvaloniaUI libraries (Charts, Markdown, TreeDataGrid, etc.); a single key that lists AvaloniaUI.DiagnosticsSupport.HotReload among its products is sufficient. The license is validated at runtime against the build timestamp embedded in this assembly, so keep the key valid for the date your application is built.

Because hot reload is intended for development builds, you typically only need the key in Debug (matching the PackageReference condition above).

Configuration

Property Default Description
AvaloniaHotReloadEnableFileWatcher false When true, watches .axaml files on disk and reloads them even when the .NET Hot Reload agent is not attached. Useful when running the app outside of dotnet watch.
AvaloniaHotReloadIncremental true When true, control reloads diff the old and new XAML and patch only the changed portions of live instances, preserving all runtime state for expressible edits. Set to false to always rebuild instances (the previous behavior).

Set it in your .csproj:

<PropertyGroup>
  <AvaloniaHotReloadEnableFileWatcher>true</AvaloniaHotReloadEnableFileWatcher>
</PropertyGroup>

Manual initialization

Auto-setup is sufficient for almost all scenarios. For advanced cases (custom lifecycle, multiple Application instances, deferred startup), call the API directly:

using AvaloniaUI.DiagnosticsSupport.HotReload;

HotReloadExtensions.InitializeHotReload(
    Application.Current!,
    enableFileWatcher: true,
    rewriteStaticResources: true,
    enableIncrementalReload: true);

Subsequent calls are no-ops — the engine can only be initialized once per process.

Access the live engine via HotReloadExtensions.Engine if you need to trigger reloads programmatically or inspect state.

Embedded hosts

Hot reload works when Avalonia runs as an embedded control. Live TopLevels (including EmbeddableControlRoots) are tracked automatically as they load and unload.

If your embedded root was already live before hot reload initialized, or never raises Loaded, register it explicitly:

using AvaloniaUI.DiagnosticsSupport.HotReload;

IDisposable registration = HotReloadExtensions.RegisterTopLevel(embeddableControlRoot);

Limitations

  • C# changes follow the normal .NET Hot Reload rules — adding fields, changing method signatures, etc. are subject to the usual "rude edit" restrictions.
  • Edits the incremental differ cannot express (root type or x:Class changes, xmlns changes, renames, very large edits) rebuild the affected instances; non-XAML runtime state inside rebuilt subtrees is reset except for what ReloadStatePreserver carries over (nested x:Class controls, common interaction state).
  • Edits inside DataTemplate/ControlTemplate bodies reload the template value and refresh consumers; already-instantiated template content is rebuilt.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 88 9/24/2026
1.0.0 1,261 9/2/2026