I thought I had tried it with the normal console, but I can’t reproduce it today there. I first noticed it in VSCode and I know it also happened in ISE, both of which I can reproduce it in today. Maybe this only happens when you run it as a script. Indeed, if I put it in a ps1 file and run it from the console, I can reproduce it as well.
After I posted this, I thought about it and realized it probably isn’t changing the contents of the variable, just how it decides to display the object. But I’m not sure why it would do that. Seems like a bug.
@js, I didn’t reassign the variable after line 1 like you did, I just outputted it. If I reassigned it, I would expect the object type to change.
@postanote, All of your tests appear to be my 2nd block of code. You assign, output, select, then output. Try assign, select, output to reproduce it (and note, as I explain above, I’m only getting this behavior in when running as a script).
@kvprasoon, I am sure. Take what you reposted and pop it in ISE and run it. Then remove line 2 and run it again and compare the output.