The property 'OnRemove' cannot be found on this object
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.

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
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?
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
@rjmholt Is there an async at the module load time?
@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