mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-06 12:09:01 +00:00
27145ee53e
A binary module assembly loads once per process, so the internal static ActiveSession slot was shared by every runspace in the host. Under ForEach-Object -Parallel, a multi-runspace host or a JEA endpoint, one runspace's Connect-PveServer retargeted another runspace's next cmdlet, and a credential established in one runspace was reachable from all of them. The session now lives in the module's own session state, which PowerShell creates once per runspace, read and written through ModuleState.GetActiveSession/SetActiveSession behind the existing single read point PveCmdletBase.GetSession(). The name is scope-qualified so a nested scope cannot write a copy that dies with it, nor read through to a same-named global. A module imported from the assembly rather than the manifest has no session state; that path falls back to the runspace's global scope, which is still per-runspace. No IModuleAssemblyCleanup: no mutable static remains to clear. Closes #150 Co-authored-by: goodolclint-claude[bot] <323206664+goodolclint-claude[bot]@users.noreply.github.com>