Class HotReloadService

Assembly: redb.Tsak.Core.dll

Manages hot reload of module assemblies.
Monitors configured directories for new DLLs, loads them in collectible ALCs,
performs graceful swap (stop old → start new), and supports auto-rollback.

public sealed class HotReloadService : IDisposable

Inheritance

Object→HotReloadService

Implements

Properties

LeakedAlcCount

Module load contexts still in memory after Tsak let them go, in both modes of

public int LeakedAlcCount { get; }

Methods

AdoptStartupPackages(IReadOnlyDictionary<string, ModulePackage>)

Adopts packages loaded during startup discovery (by TsakModuleRegistry).

public void AdoptStartupPackages(IReadOnlyDictionary<string, ModulePackage> packages)

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

HotSwapAsync(string, string, string, CancellationToken)

Performs hot swap of a single module: load new → stop old → unload old → start new.

public Task<bool> HotSwapAsync(string moduleName, string newDllPath, string newVersion, CancellationToken ct = default)

ReloadPackageAsync(string, List<string>, CancellationToken)

Reloads a .tpkg package in place: the old modules leave the registry silently (no events), the

public Task<int> ReloadPackageAsync(string tpkgPath, List<string> oldModuleNames, CancellationToken ct = default)

RollbackAsync(string, CancellationToken, string?)

Rolls back a module to the previous version.

public Task<bool> RollbackAsync(string moduleName, CancellationToken ct = default, string? overwrittenPath = null)

ScanAndReloadAsync(IEnumerable<string>, CancellationToken)

Scans the given directories for updated module DLLs and hot-swaps any that have newer versions.

public Task<int> ScanAndReloadAsync(IEnumerable<string> paths, CancellationToken ct = default)

TrackModule(string, string, string)

Tracks a module loaded via the initial discovery (not via hot reload).

public void TrackModule(string moduleName, string dllPath, string version)

UnloadModuleAsync(string, CancellationToken)

Gracefully stops a module context, unregisters the module, and cleans up ALC state.

public Task<bool> UnloadModuleAsync(string moduleName, CancellationToken ct = default)

Constructors