Roman Kuzmin

My feedback

  1. 3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 

    It looks fixed in v6-beta.1

    Roman Kuzmin supported this idea  · 
  2. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 

    This used to be the same for files (tested in v2) and then fixed at some point for files (tested in 5.1). If this is by design then the cmdlet help should tell this.

    See some tests:
    https://github.com/nightroman/PowerShellTraps/tree/master/Cmdlets/Remove-Item/Exclude-may-be-ignored

    Roman Kuzmin supported this idea  · 
  3. 16 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  4 comments  ·  PowerShell » PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  4. 4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » Documentation  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  5. 5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  6. 3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin shared this idea  · 
  7. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin shared this idea  · 
  8. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin shared this idea  · 
  9. 1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 

    > In PS 5.1 or newer, $PSEdition global variable is allowed in the module manifest file.

    Just in case, I tried to use $PSEdition in a manifest in PS 5.1 Preview.
    I get the error:

    A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that can be referenced include the following:
    $PSCulture, $PSUICulture, $true, $false, $null..

    Roman Kuzmin commented  · 

    All right then, if this is done for a reason.

    Roman Kuzmin shared this idea  · 
  10. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin shared this idea  · 
  11. 18 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  PowerShell » Documentation  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 
    Roman Kuzmin supported this idea  · 
  12. 4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin shared this idea  · 
  13. 16 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  14 comments  ·  PowerShell » Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 

    I believe the pair ConvertTo-Json and ConvertFrom-Json is supposed to serialize
    and deserialize data, and the data should be semantically compatible, at least
    to some extent (JSON is not that flexible).

    The current effort of ConvertTo-Json to convert custom properties of standard
    types has low value. Rehydrated values are changed completely. The code should
    know when it deals with the original data and when with rehydrated.

    To deal with this, a code writer should redesign the objects, e.g. create
    proper property bags, aggregate a standard object (e.g. a collection), add
    other custom properties. In other words, to avoid what ConvertFrom-Json is
    doing. So why is this needed at all?

    All in all, I vote for simple and clear ConvertTo-Json which converts just base
    objects without extra properties unless the base object is PSCustomObject, i.e.
    a PSObject is a true custom object. If users need to store and restore extra
    properties they use custom objects. Just like now, if rehydrated objects should
    be similar to the original (which is probably the case).

    Roman Kuzmin commented  · 

    So one possible and easy to document way is: ConvertTo-Json does not convert
    custom properties unless they are properties of a true property bag, i.e. a
    PSObject wrapping PSCustomObject. It is not perfect but it is very clear.
    And it is very simple to implement.

    On the other hand, if ConvertTo-Json should support any objects with custom
    properties then it is still a lot of work to do. And this would be an effort
    for fragile and rather rare cases of adding custom properties to standard
    types. The current approach has current and future issues (see my examples). I
    do not see, for example how to easily resolve conflicts with potential user
    properties named 'value' or 'Value'. It is not a rare name, by the way.

    Roman Kuzmin commented  · 

    @PetSerAl,
    Good question.

    Your example shows the dilemma, indeed. Even though adding PS custom properties
    to standard types is a fragile approach, IMHO. If I am not mistaken, there
    were reported scenarios when such properties got lost on various operations.
    ConvertTo-Json may loose them too right now, see examples.

    The behaviour should be at least documented and consistent across types.

    Some contrived examples with inconsistencies and issues:

    ------8<-------

    # ExtraPropertyValue, value, Count : why Count? value already represents a wrapped object
    ConvertTo-Json (,(1,2) | Add-Member ExtraPropertyName ExtraPropertyValue -PassThru)

    # ExtraPropertyValue, value : note that there is no Length (like Count in the above)
    ConvertTo-Json ('zz' | Add-Member ExtraPropertyName ExtraPropertyValue -PassThru)

    # ExtraPropertyValue, a, b : why not wrapped by value?
    ConvertTo-Json (@{a=1; b=1} | Add-Member ExtraPropertyName ExtraPropertyValue -PassThru)

    # a, b : not wrapped and a=42 lost (not a surprise but it would not be lost if value is used)
    ConvertTo-Json (@{a=1; b=1} | Add-Member a 42 -PassThru)

    # value, Count : note that the custom value=42 is lost
    ConvertTo-Json (,(1,2) | Add-Member value 42 -PassThru)

    # value, Value, Count : this JSON cannot be imported by ConvertFrom-Json
    $json = ConvertTo-Json (,(1,2) | Add-Member Value 42 -PassThru)
    $json | ConvertFrom-Json

    ------8<-------

    Roman Kuzmin supported this idea  · 
  14. 3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  PowerShell » Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  15. 9 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  16. 5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  4 comments  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  17. 4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  PowerShell » Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin commented  · 

    > provide some data on what kind of scenario this might be impacting for you

    In theory, here is a possible unwanted scenario:

    $service = Get-ServiceToStop ...
    Get-Service $service | Stop-Service

    If Get-ServiceToStop is expected to get something but returns nothing then all services are going to be stopped.

    Roman Kuzmin commented  · 

    Agree.

    Get-Alias -Name $null -- also returns all items, it's not quite right.

    Get-Process, Get-Variable fail -- good.

    Roman Kuzmin supported this idea  · 
  18. 6 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  19. 3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
  20. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Roman Kuzmin supported this idea  · 
← Previous 1

Feedback and Knowledge Base