Closed joshtransient closed 3 years ago
@joshtransient I don't want to open the jar of parsing the config in Powershell. You can however set $env:AZ_ENABLED=$false
to avoid the module being loaded.
@joshtransient any update on your end?
Env variable works. I'll close it
Ended up coming to the same conclusion, for some reason, Get-AzContext
takes 1 to 3 seconds to run and it was absolutely killing performance and driving me insane (thinking the Git perf issues came back). If we don't want to open the can of worms (which I understand), can we add something to the install docs mentioning that, if you have the Az module installed and you do not use the Az segment, it'd be worth your time to disable support?
@gibwar where would you look for that information?
I was originally thinking on the pwsh section, but that may be too narrow, since I guess it could happen on other platforms (though I only use pwsh on Windows). Since I know there have been issues past with outdated Git versions and slowness and whatnot, maybe a troubleshooting page may be beneficial?
Putting it on the Azure segment wouldn't make sense, since I am not using it, I wouldn't have looked there. The way I ended up identifying the cause was originally wrapping the prompt
function with stopwatch calls to see the 3s lag, then running Write-PoshDebug
was about 100ms (on a Git repo), and eventually added Set-PSDebug -Trace 2
to see the calls inside Initialize-ModuleSupport
where the delay occurred.
@gibwar FAQ section coming
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
I load a theme that doesn't contain Azure or Azure Functions blocks, and the Az.Accounts module loads regardless. With PowerShell 7+, this prevents loading any other module that relies on a different version of MSAL.NET to do authentication. Can a check be added to only load Az.Accounts if a theme uses it?
Environment
Steps to Reproduce
Import-Module oh-my-posh
Import-Module
any module that uses MSAL.NET (e.g. MSAL.PSExpected behavior: No error message
Actual behavior: Error message from step (4) above