Azure / Azure/CloudShell

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

Offen
#284 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @theJasonHelmick Auf GitHub ansehen
Area-image bug Iteration-Backlog
Vorherrschende Sprache
PowerShell
Sterne
273
Forks
117
Ø Merge
1 Std.
Gemergte PRs (30 T.)
2

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.