I have just experienced a fairly weird session with Powershell/ISE.
I have been working on a script of about 300 lines including comments (60% comments).
As I repeatedly ran the script with errors the several few times until I got it “error free”, I had to manually delete a folder which was created by this script because Powershell execution fails on a Remove-Item – claiming it is in use and therefore cannot be deleted. This occurred several times and sometimes I just cancelled out and started all over.
After a few more trials, my simple hash tables were yielding empty strings - these are “vanilla” hash tables that do nothing more than sequentially map 1,2,3 to file1, file2 and file3 which are in different subdirectories (i.e., path names).
I struggled with just about everything to no avail – because the value results of the hash tables were yielding empty results, my queries also yielded fatal errors complaining that the filepath parameter could not be resolved.
After nearly 3 hours of insignifcant code changes here and there, in desperation, I exitted PS, rebooted my PC and everything suddenly just worked, i.e., those error messages just went away.
Is there some “dynamic” in Powershell/ISE in which – and I am saying this very crudely, as a beginner – the “state” of what you’ve “previously done” after repeated runs of the same script (many incomplete or aborted, plus changes here and there) is “carried over” and persists in a way that distorts the debugging of the script?
I don’t know if this is makign sense, but would appreciate any tips or recommendations on this rather bizarre experience.
Thanking you in advance.