Azure / Azure/CloudShell

PowerShell: "The variable '$elapsed' cannot be retrieved because it has not been set."

Aperta
#284 0 commenti 0 reazioni 1 assegnatario Rivendicata da @theJasonHelmick Vedi su GitHub
Area-image bug Iteration-Backlog
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:
image

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.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.