Interface IRuntimeSession
The root of an execution session. A single session holds the statically-defined symbols and, depending on the host mode, serves as the run-time or break (debug) session — it is independent of the host's current mode.
public interface IRuntimeSession
- Extension Methods
Remarks
⚖️RDCore provides an implementation of this interface licensed under GPLv3.
Properties
CallStack
The session's call stack — pushing and popping an ICallStackFrame per procedure activation is what makes a procedure's locals and parameters visible through ISessionSymbols's Resolver (RD-VBAL §2.3.1.2's local stack frame heap tier).
ICallStack CallStack { get; }
Property Value
Environment
The host environment this session runs in — bitness (Environment.Is64Bit drives
LongPtr width and #If Win64 / #If VBA7), locale, code page, …
IRuntimeEnvironmentProfile Environment { get; }
Property Value
Errors
The session's error state — what the Err object reports
(MS-VBAL §6.1.3.2), and what outlives the activation that raised it.
ISessionErrorState Errors { get; }
Property Value
Files
The file numbers this session has open (MS-VBAL §5.4.5).
IFileChannels Files { get; }
Property Value
Remarks
Session-scoped because the association an Open makes "remains in effect until... explicitly
disassociated using a close-statement" - it outlives the procedure that opened it.
Lifecycle
What raises the lifecycle events of the session's objects, or null while nothing can run user code against the session yet — a session whose symbols are only being defined. Set by whatever composes the execution pipeline, which is what the handlers run through.
IObjectLifecycle? Lifecycle { get; set; }
Property Value
Remarks
While it is null, ReleaseReference(VBRuntimeObjectId, IBindingHandle) destroys an object that has no references
left without raising Terminate.
Memory
The session's memory allocator — tracks allocation size and fragmentation, MSVBVM-style.
ISessionMemoryAllocator Memory { get; }
Property Value
Objects
The session's object lifetime manager.
ISessionObjects Objects { get; }
Property Value
Output
Where this session's Print output goes (MS-VBAL §5.4.5.8) — the
Immediate window's analogue. NullRuntimeOutput when the session was
composed without one, so a Debug.Print is a no-op rather than an error.
IRuntimeOutput Output { get; }
Property Value
References
The workspace's references in declaration order (RD-VBAL §2.3.1.2): index
0 appears first and is the lowest precedence (the VBA standard library), so a
later entry shadows it on a global-scope name collision. This is the precedence order only —
a reference's members are resolved through ISymbolResolver, not from here. Preserved
exactly as the language server provides it; empty when the session was composed without a
project (e.g. a bare REPL).
IReadOnlyList<ReferencePriorityInfo> References { get; }
Property Value
Storage
The session's value storage — what is bound at each address its allocator handed out.
ISessionStorage Storage { get; }
Property Value
Remarks
Reachable from the session because direct, byte-level access to a session's memory is a
session-level operation: a debugger reading a variable's bytes, a PEEK, a POKE.
Ordinary name-based reads and writes go through Resolver instead.
Symbols
The session's symbol table.
ISessionSymbols Symbols { get; }
Property Value
Methods
ReleaseReference(VBRuntimeObjectId, IBindingHandle)
Drops handle's reference to instance and, if that was its
last remaining reference, destroys the object: frees the storage its live instance allocated
(DestroyInstance(VBRuntimeObjectId)) and forgets it (TryRemoveObject(VBRuntimeObjectId)).
bool ReleaseReference(VBRuntimeObjectId instance, IBindingHandle handle)
Parameters
instanceVBRuntimeObjectIdhandleIBindingHandle
Returns
- bool
trueif the object was destroyed as a result of this call.
Remarks
This is the only correct way to drop a reference — calling RemoveRef(VBRuntimeObjectId, IBindingHandle) directly leaves the instance's field storage allocated forever once the count reaches zero, since nothing else would go on to call DestroyInstance(VBRuntimeObjectId) for it.