PowerShell: "The variable '$elapsed' cannot be retrieved because it has not been set."
- Lingua principale
- PowerShell
- Stelle
- 273
- Fork
- 117
- Merge medio
- 1h
- PR unite (30g)
- 2
Descrizione
When I now log in to Azure Cloud Shell using PowerShell I get this error:
```
InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:268
Line |
268 | if($elapsed -gt '1000')
| ~~~~~~~~
| The variable '$elapsed' cannot be retrieved because it has not been set.
```
here's what is happening:

The profile file `/opt/microsoft/powershell/7/profile.ps1` is part of the Azure Cloud Shell.
I have `Set-StrictMode -Version latest` in my PowerShell profile. If I remove this the error goes away.
I think the default for Azure Cloud Shell PowerShell should use strict mode to catch unnecessary issues.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.