Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter help is not shown, even though the help info is available in the database #64

Closed
Jawz84 opened this issue May 18, 2022 · 7 comments · Fixed by #68
Closed

Parameter help is not shown, even though the help info is available in the database #64

Jawz84 opened this issue May 18, 2022 · 7 comments · Fixed by #68

Comments

@Jawz84
Copy link
Owner

Jawz84 commented May 18, 2022

Just did a quick test with

Get-VM | Get-Stat -Stat 'cpu.usage.average' -Realtime

It looks as if the explanation for the parameters is not expanded,

image

although it is available in the help.

image

Originally posted by @lucdekens in #63 (comment)

@Jawz84
Copy link
Owner Author

Jawz84 commented May 18, 2022

I can reproduce this on production by running get-stat -realtime.

I have confirmed that the intended data is available in the Azure DB with all the help info:

(...)
{
    "Aliases": "none",
    "DefaultValue": "False",
    "Description": "Indicates whether the command collects real time statistics.",
    "Globbing": "false",
    "IsDynamic": false,
    "Name": "Realtime",
    "ParameterSets": {
      "__AllParameterSets": {
        "IsMandatory": false,
        "Position": -2147483648,
        "ValueFromPipeline": false,
        "ValueFromPipelineByPropertyName": false,
        "ValueFromRemainingArguments": false,
        "HelpMessage": null,
        "HelpMessageBaseName": null,
        "HelpMessageResourceId": null
      }
    },
    "PipelineInput": "False",
    "Position": "named",
    "Required": "false",
    "SwitchParameter": true,
    "TypeName": "SwitchParameter"
  },
(...)

Relevant line of code

TODO:
Reproduce locally so I can test.

@Jawz84
Copy link
Owner Author

Jawz84 commented May 18, 2022

Ok local repro succeeded. Log says:

[2022-05-18T09:54:05.007Z] PowerShell code sent: get-stat -realtime
[2022-05-18T09:54:05.038Z] Failed to get Description for parameter 'realtime' on command 'Get-Stat': The JSON value could not be converted to explainpowershell.models.ParameterTypeData. Path: $[0].TypeName | LineNumber: 24 | BytePositionInLine: 33.

@lucdekens
Copy link

It looks like those missing help lines are not exclusive for PowerCLI cmdlets.

The following example shows the same lack of help info for both parameters.

import-module -name test.module -allowclobber

image

@Jawz84
Copy link
Owner Author

Jawz84 commented May 18, 2022

I was starting to suspect exactly this. The error says the json cannot be parsed to the target schema/type in C#. So I messed something up there.
Clearly a test should have been in place for this scenario.
I am out of time and energy for today. Will continue later. Feel free to have a look at the code if you feel like that kind of thing.

@Jawz84
Copy link
Owner Author

Jawz84 commented May 21, 2022

It seems there there are two problems here: one is that for some cmdlets, the parameter help is so big, it doesn't fit the 64k limit in an Azure Table storage property. This is why Import-Module -name didn't return any help (-allowclobber is not a valid param here). So that part needs some work, because it means some module help imports may have failed because the Parameter property data was too big. It appears I can compress the json before uploading, and that saves quite a bit of space. This is what I did to fix this for Import-Module. But now I have to figure out a way to fix this at scale.

The other problem (where the parameter data does not fit the schema) I have not even touched yet.

image

@Jawz84
Copy link
Owner Author

Jawz84 commented Jun 4, 2022

TODO: find out why sometimes the stored parameter data does not fit the json schema to load them

@Jawz84
Copy link
Owner Author

Jawz84 commented Jun 6, 2022

Thanks @lucdekens for your patience on this one. Part one is now fixed as you can see:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants