Table of Contents

Class PackLoadManager

Namespace
KernLab.Cell.Runtime
Assembly
KernLab.Cell.Runtime.dll

ALC 管理五件(总体设计 §6.2——容器内的核心机器,缺一件即偏离):

①隔离拓扑:容器自身+契约=默认 ALC;每 pack 一个 collectible ALC。

②契约单源解析(第一规则):契约程序集一律落默认 ALC——杜绝契约类型跨边界分裂。

③解析策略:AssemblyDependencyResolver(.deps.json 私有依赖目录);全程无 GetTypes 遍历。

④Resolving 事件兜底=计数+取证事件,禁静默 fallback——解析失败=装载错误(ExitCode 11)。

⑤卸载确认:Unload+WeakReference 探活+超时窗;挂起不阻塞容器(取证事件+容器照常服务)。

public sealed class PackLoadManager : IDisposable
Inheritance
PackLoadManager
Implements
Inherited Members

Constructors

PackLoadManager(IEnumerable<string>?)

构造。

public PackLoadManager(IEnumerable<string>? sharedContractAssemblies = null)

Parameters

sharedContractAssemblies IEnumerable<string>

契约单源集(程序集简单名——缺省含 Contracts、 Loom.Abstractions 与签名泄漏依赖 System.IO.Pipelines)。缺省集不足时经 SharedContractAssemblies 从宿主注入(替换语义——连同缺省项一并列全)。

Properties

DefaultLoadContext

默认 ALC(容器 runtime 自身+契约程序集——契约单源的落点)。

public AssemblyLoadContext DefaultLoadContext { get; }

Property Value

AssemblyLoadContext

Diagnostics

诊断事件快照(解析失败取证/卸载挂起取证)。

public IReadOnlyList<PackLoadDiagnostic> Diagnostics { get; }

Property Value

IReadOnlyList<PackLoadDiagnostic>

ResolvingFallbackCount

解析兜底计数(④——禁静默:此计数增长即解析缺口,装载错误的前兆)。

public long ResolvingFallbackCount { get; }

Property Value

long

Methods

Dispose()

public void Dispose()

Load(string)

装载一个 pack(每 pack 一个 collectible ALC——③确定性解析、零扫描)。

public LoadedPack Load(string packPath)

Parameters

packPath string

Returns

LoadedPack

UnloadAsync(LoadedPack, TimeSpan)

卸载确认(⑤):Unload+WeakReference 探活+超时窗。挂起不阻塞容器—— 挂起的 ALC 连同取证线索(诊断事件)落地,容器照常服务;彻底清理兜底=换容器(D11)。

public Task<bool> UnloadAsync(LoadedPack pack, TimeSpan confirmTimeout)

Parameters

pack LoadedPack
confirmTimeout TimeSpan

Returns

Task<bool>

true=卸载确认完成;false=挂起(取证已记录——容器照常服务)。