fix(khdb): fail clearly when a stale compiled type is loaded in the session

Add-Type cannot replace a type that an older build of KhdbMerge.ps1 already defined, so
an updated PasswordQuality.ps1 failed with "does not contain a method named 'Inspect'".
Check for the newest method after the guarded Add-Type and tell the operator to start a
new PowerShell session.
This commit is contained in:
2026-11-06 08:02:34 +01:00
parent 69c8185697
commit a945960cef
+6
View File
@@ -203,3 +203,9 @@ namespace Elysium
}
'@
}
# A compiled type cannot be replaced inside a running process. If an older build of this file already
# defined it (module re-imported or scripts updated in a long-lived console), fail with the fix.
if (-not [Elysium.KhdbText].GetMethod('Inspect')) {
throw 'Elysium.KhdbText is loaded from an older build in this PowerShell process. Close this window and start a new one.'
}