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:
@@ -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.'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user