Fix Progress Preference variable in adv functions by cmkb3 · Pull Request #24591 · PowerShell/PowerShell

@cmkb3 Sorry it took so long to review this PR!

The fix looks good, but I pushed a commit for 2 minor changes:

  1. Move the assertions to the static constructor of Compiler. This is where AutomaticVariableTypes and PreferenceVariableTypes get used, and more importantly, this code path will always be hit, so if they are out of sync, we will know immediately.
  2. Update the tests a little -- a) $ps is created before each It test and disposed afterwards, so the newly added tests should not create new PowerShell instances. b) also add a parameter in the 2nd test case.