Table of Contents

Class ExtensionReload

Namespace
Valheim.Testing.Game
Assembly
Valheim.Testing.Game.dll

The steps of a hot-reload smoke test of a game-side extension (see tools/reload-check): replace the extension's DLL in the reloader's watched directory without it ever seeing a half-written file, then wait until the replacement has registered as a new instance, or until a removed extension is gone. Waiting re-reads cli_extensions (read-only) at an interval, because a registration announces itself nowhere else. Use a GameActor whose pins allow the reload (WaitForEnvironment(string, TimeSpan, CancellationToken) first) and rediscover capabilities afterwards: the new instance's are new.

public static class ExtensionReload
Inheritance
object
ExtensionReload

Methods

Find(GameActor, string)

The live registration of id, or null. Two live registrations of one ID fail.

public static ExtensionInstance? Find(GameActor actor, string id)

Parameters

actor GameActor
id string

Returns

ExtensionInstance

Install(string, string)

Replaces deployed with a copy of artifact: copied to deployed.incoming beside it first, then renamed over it, so a directory watcher sees one complete file.

public static void Install(string artifact, string deployed)

Parameters

artifact string
deployed string

WaitForRemoval(GameActor, string, TimeSpan, TimeSpan, CancellationToken)

Waits until no live registration of id remains.

public static Task WaitForRemoval(GameActor actor, string id, TimeSpan timeout, TimeSpan interval, CancellationToken cancellation = default)

Parameters

actor GameActor
id string
timeout TimeSpan
interval TimeSpan
cancellation CancellationToken

Returns

Task

WaitForReplacement(GameActor, string, string, string?, TimeSpan, TimeSpan, CancellationToken)

Waits until id is live at version with an instance other than replacing (the instance before the reload; null for a first install) and returns it.

public static Task<ExtensionInstance> WaitForReplacement(GameActor actor, string id, string version, string? replacing, TimeSpan timeout, TimeSpan interval, CancellationToken cancellation = default)

Parameters

actor GameActor
id string
version string
replacing string
timeout TimeSpan
interval TimeSpan
cancellation CancellationToken

Returns

Task<ExtensionInstance>