UnixCompleters icon indicating copy to clipboard operation
UnixCompleters copied to clipboard

The property 'OnRemove' cannot be found on this object

Open glenncarr opened this issue 5 years ago • 4 comments

Hello, I'm using Azure Cloud Shell and I'm encountering this error when running a PowerShell script. My script manages VMs. Any ideas?

InvalidOperation: /usr/local/share/powershell/Modules/Microsoft.PowerShell.UnixCompleters/0.1.1/OnStart.ps1:12
Line |
  12 |      $m.OnRemove = {
     |      ~~~~~~~~~~~~~~~
     | The property 'OnRemove' cannot be found on this object. Verify that the property exists and can be set.

I'll post a script when I get a chance to sanitize it.

image

Environment data

PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Linux 4.15.0-1095-azure #105~16.04.1-Ubuntu SMP Sun Sep 6 00:30:35 UTC 2020
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

glenncarr avatar Sep 15 '20 16:09 glenncarr

Hmmm, that's strange. I've never seen that reported before. Does the module import properly otherwise? Does gmo Microsoft.PowerShell.UnixCompleters give you back a result?

rjmholt avatar Sep 15 '20 21:09 rjmholt

It does:

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     0.1.1                 Microsoft.PowerShell.UnixCompleters {Import-UnixCompleters, Remove-UnixCompleters, Set-UnixCompleter}

The unfortunate (or fortunate?) is that I'm no longer seeing the error.

Thank you for your response. I'll repost if it occurs again.

Glenn

glenncarr avatar Sep 16 '20 02:09 glenncarr

@rjmholt Is there an async at the module load time?

iSazonov avatar Sep 16 '20 04:09 iSazonov

@rjmholt Is there an async at the module load time?

I don't believe there's any async or task usage in the module at all

rjmholt avatar Sep 28 '20 13:09 rjmholt