Michael Klement
Michael Klement
Or, more concisely, using `??`, the [null-coalescing operator](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Operators#null-coalescing-operator-): `Test-Path ($env:VCPK_ROOT ?? '')` (use `-LiteralPath` if needed).
@rkitover > I also very often use -ea ignore for these purposes. Good point; unlike `2>$null` - which is the equivalent of `-ErrorAction SilentlyContinue` - it has the advantage of...
Note that you can even use those keywords that _do_ cause parsing errors at the start of a statement as function / alias / script names, as long as you...
Just to spell out the likely technical root of the problem: a surrogate pair, even though it is _conceptually_ a _single_ character, in .NET is represented as _two_ `[char]` instances...
To provide a simpler repro and more background information: ```powershell [ordered] @{ '👨🌾' = 'foo' 'bar' = 'baz' } ``` Output: ```none Name Value ---- ----- 👨🌾 foo bar baz...
On second thought, I missed @MattKotsenas' point about `` "`0" `` (`NUL`) also measuring as having length `1`, and it seems that `StringInfo`'s `LengthInTextElements` property _generally_ does _not_ take into...
@SteveL-MSFT, on further reflection, `StringInfo` never mentions the aspect of _visibility_ of a character, so from the perspective of what perhaps can be called a _user-conceptualized character_, `NULL` is indeed...
Thanks for digging deeper, @iSazonov - I was not aware of these subtleties. What it comes down to is to correctly count how many _terminal buffer cells_ (character positions) a...
@iSazonov: I may be missing something, but it seems that the only reference to the `char` overload is from the `string`-based one, which in turn is the one called from...
I haven't looked at the other code and discussions, but I've generalized the [algorithm I've described above](https://github.com/PowerShell/PowerShell/issues/23861#issuecomment-2150457684) (now amended) - originally, I forgot to consider that all _non-BMP_ full-width or...