PowerShell: "The variable '$elapsed' cannot be retrieved because it has not been set."
- Dominant language
- PowerShell
- Stars
- 273
- Forks
- 117
- Avg merge
- 1h
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.