Importing the module fails with repeated errors
This is with PS7.1 I get like 100 or so of this error when i import the module
`MethodInvocationException: C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1:197 Line | 197 | $this.Shortnames = $string.substring($offsets[1],($offsets[2] … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero. (Parameter 'length')"
MethodInvocationException: C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1:197 Line | 197 | $this.Shortnames = $string.substring($offsets[1],($offsets[2] … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero. (Parameter 'length')" `
Here it the Get-error output ` Exception : Type : System.Management.Automation.MethodInvocationException ErrorRecord : Exception : Type : System.Management.Automation.ParentContainsErrorRecordException Message : Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero. (Parameter 'length')" HResult : -2146233087 CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException FullyQualifiedErrorId : ArgumentOutOfRangeException InvocationInfo : ScriptLineNumber : 197 OffsetInLine : 9 HistoryId : -1 ScriptName : C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1 Line : $this.Shortnames = $string.substring($offsets[1],($offsets[2]-$offsets[1])).Replace(" ","").Split(",")
PositionMessage : At C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1:197 char:9
+ $this.Shortnames = $string.substring($offsets[1],($offsets[2] …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3
PSCommandPath : C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1
CommandOrigin : Internal
ScriptStackTrace : at KubeResource, C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1: line 197
at <ScriptBlock>, C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1: line 298
at Get-KubeResource, C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1: line 298
at Initialize-ProxyFunction, C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1: line 312
at <ScriptBlock>, C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1: line 425
at <ScriptBlock>, <No file>: line 1
`
I get like 100 or so of this error when i import the module
` MethodInvocationException: C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1:197 Line | 197 | $this.Shortnames = $string.substring($offsets[1],($offsets[2] … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero. (Parameter 'length')"
MethodInvocationException: C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.KubeCtl\0.0.3\Microsoft.PowerShell.KubeCtl.psm1:197 Line | 197 | $this.Shortnames = $string.substring($offsets[1],($offsets[2] … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero. (Parameter 'length')" `
Probably due to kubectl changes. Found this workaround:
- $FIELDS = "NAME","SHORTNAMES","APIGROUP","NAMESPACED","KIND","VERBS"
+ $FIELDS = "NAME","SHORTNAMES","APIVERSION","NAMESPACED","KIND","VERBS"