PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 490 forks source link

Extension randomly runs something in the background when writing in the code pane #4773

Open o-l-a-v opened 1 year ago

o-l-a-v commented 1 year ago

Prerequisites

Summary

Related issues:

While writing PowerShell in the code pane the terminal suddenly seems to have ran something on my unfinished code, and must be exited with CTRL+C to stop.

image

In this example I was going to write Get-AzResource, only got to Get-AzResour before a warning pops up saying WARNING: Get-AzResour is not found. The most similar Azure PowerShell command is: Get-AzResource.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.3.7
PSEdition                      Core
GitCommitId                    7.3.7
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Modules

Name                              Version
----                              -------
Az.Accounts                       2.13.1
Az.Network                        6.2.0
Az.Resources                      6.11.1
Microsoft.PowerShell.Management   7.0.0.0
Microsoft.PowerShell.Security     7.0.0.0
Microsoft.PowerShell.Utility      7.0.0.0
PowerShellEditorServices.Commands 0.2.0
PowerShellEditorServices.VSCode   0.2.0
PSReadLine                        2.2.6

Visual Studio Code Version

1.83.0
e7e037083ff4455cf320e344325dacb480062c3c
x64

Extension Version

ms-vscode.powershell@2023.6.0

Steps to Reproduce

Write PowerShell in the code view, suddenly something (vscode-powershell? PSReadLine?) triggers something that outputs to the terminal.

Visuals

See summary.

Logs

Tried following https://github.com/PowerShell/vscode-powershell/blob/main/docs/troubleshooting.md#logs But there's no log directory inside %USERPROFILE%\.vscode\extensions\ms-vscode.powershell-2023.6.0, even after I added following to settings.json:

"powershell editor services.trace.server": "verbose",
"powershell.developer.editorServicesLogLevel": "Diagnostic"

Edit: Logs are apprently located at %APPDATA%\Code\User\globalStorage\ms-vscode.powershell\logs, with one new directory created at each new session.

Edit 2: I reproduced with mentioned changes to settings.json above, sent logs per email.

SydneyhSmith commented 1 year ago

Thanks for letting us know about this @o-l-a-v , @StevenBucher98 do you think this is coming from a feedback provider?

StevenBucher98 commented 1 year ago

Feedback providers are still in experimental so it would only affect it if the experimental feature was set to true. The text is from Az cmdlets own feedback system, tagging @dcaro if he thinks this may be an issue on their end.

The fact it seemingly execute your command before you finish typing it is very weird. Does this happen with any other commands or just Az.* cmdlets?

o-l-a-v commented 1 year ago

@StevenBucher98

This has just happened with the Az modules for me. Haven't done much work with other modules the last months.

dcaro commented 1 year ago

@Alex-wdy, @isra-fel PTAL, this seems to be related to the cmdlet discovery mechanism of Az 10.3 / Az.Accounts 2.13.0 @o-l-a-v using the previous version of Az.Accounts (2.12 or less) should provide a temporary workaround.

andyleejordan commented 11 months ago

Sounds like this is not a VS Code extension bug at this point, is there an Az module issue we can reference and close this?

o-l-a-v commented 11 months ago

Happened again today. Az.Accounts v2.13.2 and Az.SecurityInsights loaded into VSCode with PowerShell v7.4.0, vscode-powershell v2023.8.0.

PS C:\Users\olav.birkeland\OneDrive\IT\Code> PipelineStoppedException: The pipeline has been stopped.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
 Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)       
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                                             ^C
PS C:\Users\olav.birkeland\OneDrive\IT\Code>

Seems Az.SecurityInsights was to blame this time.

isra-fel commented 11 months ago

Thanks for reporting. Did Resolve-AzError not return anything?

@dolauli let's look into it tomorrow.

o-l-a-v commented 11 months ago
First reply I have some bisarre errors from `Resolve-AzError`, don't know if they're related. Did not run `Resolve-AzError` right after it happened. Will do that next time. First ```powershell Message : The term 'WhereWhere--OObbjjeecctt' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. StackTrace : at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord() Exception : System.Management.Automation.CommandNotFoundException InvocationInfo : {} Line : Get-ChildItem function: | Where-Object { ($currentFunctions -notcontains $_) -and $_.CmdletBinding } Position : At line:4 char:27 + Get-ChildItem function: | Where-Object { ($currentFunctions -notconta … + ~~~~~~~~~~~~ HistoryId : 39 ``` Second ```powershell Message : Cannot find a provider with the name 'functionfunction'. StackTrace : at System.Management.Automation.SessionStateInternal.GetProvider(PSSnapinQualifiedName providerName) at System.Management.Automation.SessionStateInternal.GetSingleProvider(String name) at System.Management.Automation.LocationGlobber.GetProviderPath(String path, CmdletProviderContext context, Boolean isTrusted, ProviderInfo& provider, PSDriveInfo& drive) at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context) at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord() Exception : System.Management.Automation.ProviderNotFoundException InvocationInfo : {Get-ChildItem} Line : $currentFunctions = Get-ChildItem function: Position : At line:2 char:21 + $currentFunctions = Get-ChildItem function: + ~~~~~~~~~~~~~~~~~~~~~~~ HistoryId : 39 ``` Third, I got a few of this one: ```powershell Message : The term 'GetGet--CChhiillddIItteemm' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. StackTrace : at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord() Exception : System.Management.Automation.CommandNotFoundException InvocationInfo : {} Line : Get-ChildItem -Path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Az.MonitoringSolutions\0.1.0\custom' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } Position : At line:3 char:1 + Get-ChildItem -Path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\ … + ~~~~~~~~~~~~~ HistoryId : 39 ``` Fourth ```powershell Message : The term '-Warning' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. StackTrace : at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script) at Microsoft.Azure.Commands.Profile.Utilities.CommandNotFoundHelper.WriteWarning(String message) at Microsoft.Azure.Commands.Profile.Utilities.CommandNotFoundHelper.OnCommandNotFound(Object sender, CommandLookupEventArgs args) at System.Management.Automation.CommandDiscovery.InvokeCommandNotFoundHandler(String commandName, ExecutionContext context, String originalCommandName, CommandOrigin commandOrigin) Exception : System.Management.Automation.CommandNotFoundException InvocationInfo : {} Line : Write-Warning 'The command Get-AzLog is part of Azure PowerShell module "Az.Monitor" and it is not installed. Run "Install-Module Az.Monitor" to install it.' Position : At line:1 char:6 + Write-Warning 'The command Get-AzLog is part of Azure PowerShell modu … + ~~~~~~~~ HistoryId : 39 ```

Edit: Found one similar crash from yesterday in the terminal, didn't close VSCode before I left work. Looks like it happened while I was writing something in the terminal.

PS C:\Users\olav.birkeland\OneDrive\IT\Code> $SentinelConnectors[1].SystemData$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
$CommandNotFoundException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                                             $SentinelConnectors[1].SystemData^C
PS C:\Users\olav.birkeland\OneDrive\IT\Code>

Edit 2: Looks like I did Resolve-AzError after above error. Here are all errors with latest HistoryId:

PS C:\Users\olav.birkeland\OneDrive\IT\Code> Resolve-AzError

   HistoryId: 39

Message        : The term 'WhereWhere--OObbjjeecctt' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Get-ChildItem function: | Where-Object { ($currentFunctions -notcontains $_) -and $_.CmdletBinding }

Position       : At line:4 char:27
                 + Get-ChildItem function: | Where-Object { ($currentFunctions -notconta …
                 +                           ~~~~~~~~~~~~
HistoryId      : 39

Message        : Cannot find a provider with the name 'functionfunction'.
StackTrace     :    at System.Management.Automation.SessionStateInternal.GetProvider(PSSnapinQualifiedName providerName)
                    at System.Management.Automation.SessionStateInternal.GetSingleProvider(String name)
                    at System.Management.Automation.LocationGlobber.GetProviderPath(String path, CmdletProviderContext context, Boolean isTrusted, ProviderInfo& provider, PSDriveInfo& drive)
                    at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context)
                    at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord()
Exception      : System.Management.Automation.ProviderNotFoundException
InvocationInfo : {Get-ChildItem}
Line           : $currentFunctions = Get-ChildItem function:

Position       : At line:2 char:21
                 + $currentFunctions = Get-ChildItem function:
                 +                     ~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 39

Message        : The term 'WhereWhere--OObbjjeecctt' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Get-ChildItem function: | Where-Object { ($currentFunctions -notcontains $_) -and $_.CmdletBinding }

Position       : At line:4 char:27
                 + Get-ChildItem function: | Where-Object { ($currentFunctions -notconta …
                 +                           ~~~~~~~~~~~~
HistoryId      : 39

Message        : Cannot find a provider with the name 'functionfunction'.
StackTrace     :    at System.Management.Automation.SessionStateInternal.GetProvider(PSSnapinQualifiedName providerName)
                    at System.Management.Automation.SessionStateInternal.GetSingleProvider(String name)
                    at System.Management.Automation.LocationGlobber.GetProviderPath(String path, CmdletProviderContext context, Boolean isTrusted, ProviderInfo& provider, PSDriveInfo& drive)
                    at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context)
                    at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord()
Exception      : System.Management.Automation.ProviderNotFoundException
InvocationInfo : {Get-ChildItem}
Line           : $currentFunctions = Get-ChildItem function:

Position       : At line:2 char:21
                 + $currentFunctions = Get-ChildItem function:
                 +                     ~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 39

Message        : The term 'GetGet--CChhiillddIItteemm' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Get-ChildItem -Path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Az.MonitoringSolutions\0.1.0\custom' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }

Position       : At line:3 char:1
                 + Get-ChildItem -Path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\ …
                 + ~~~~~~~~~~~~~
HistoryId      : 39

Message        : The term 'GetGet--CChhiillddIItteemm' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : $currentFunctions = Get-ChildItem function:

Position       : At line:2 char:21
                 + $currentFunctions = Get-ChildItem function:
                 +                     ~~~~~~~~~~~~~
HistoryId      : 39

Message        : The term 'GetGet--CChhiillddIItteemm' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.MonitoringSolutions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : $currentFunctions = Get-ChildItem function:

Position       : At line:2 char:21
                 + $currentFunctions = Get-ChildItem function:
                 +                     ~~~~~~~~~~~~~
HistoryId      : 39

Message        : The term '-Warning' is not recognized as a name of a cmdlet, function, script file, or executable program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                    at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine,
                 ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
                    at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe
                 outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
                    at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
                    at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script)
                    at Microsoft.Azure.Commands.Profile.Utilities.CommandNotFoundHelper.WriteWarning(String message)
                    at Microsoft.Azure.Commands.Profile.Utilities.CommandNotFoundHelper.OnCommandNotFound(Object sender, CommandLookupEventArgs args)
                    at System.Management.Automation.CommandDiscovery.InvokeCommandNotFoundHandler(String commandName, ExecutionContext context, String originalCommandName, CommandOrigin commandOrigin)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Write-Warning 'The command Get-AzLog is part of Azure PowerShell module "Az.Monitor" and it is not installed. Run "Install-Module Az.Monitor" to install it.'
Position       : At line:1 char:6
                 + Write-Warning 'The command Get-AzLog is part of Azure PowerShell modu …
                 +      ~~~~~~~~
HistoryId      : 39

Message        : Could not load file or assembly 'Microsoft.Azure.PowerShell.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
StackTrace     :    at System.Reflection.RuntimeAssembly.GetExportedTypes(QCallAssembly assembly, ObjectHandleOnStack retTypes)
                    at System.Reflection.RuntimeAssembly.GetExportedTypes()
                    at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name)
                    at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile,   
                 Dictionary`2& cmdlets, Dictionary`2& aliases, Dictionary`2& providers)
                    at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary`2& cmdlets,
                 Dictionary`2& aliases, Dictionary`2& providers, String& helpFile)
                    at System.Management.Automation.Runspaces.InitialSessionState.ImportCmdletsFromAssembly(Assembly assembly, PSModuleInfo module)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss,       
                 ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean& found, String shortModuleName, Boolean disableFormatUpdates)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData,
                 ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(String fileName, String moduleBase, String prefix, SessionState ss, ImportModuleOptions& options, ManifestProcessingFlags
                 manifestProcessingFlags, Boolean& found)
                    at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
                    at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.IO.FileNotFoundException
InvocationInfo : {Import-Module}
Line           : Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azure.Commands.Insights.dll)

Position       : At C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Az.Insights\0.7.0\Az.Insights.psm1:90 char:1
                 + Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 39

Message        : Assembly with same name is already loaded
StackTrace     :    at System.Management.Automation.Runspaces.InitialSessionState.Bind_LoadAssemblies(ExecutionContext context)
                    at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly, PSModuleInfo module, Boolean noClobber, Boolean local, Boolean setLocation)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData,
                 ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean&
                 containedErrors)
Exception      : System.IO.FileLoadException
InvocationInfo : {Import-Module}
Line           :     Import-Module Az.Profile -MinimumVersion 0.7.0 -Scope Global

Position       : At C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Az.Insights\0.7.0\Az.Insights.psm1:88 char:5
                 +     Import-Module Az.Profile -MinimumVersion 0.7.0 -Scope Global
                 +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 39
o-l-a-v commented 7 months ago

image

Is there a setting to disable this "smart" functionality?


Edit: Seems there is.

PS C:\Users\olav.birkeland\OneDrive\IT\Code> Disable-AzPredictor -AllSession
To disable Az Predictor, please edit your profile (<my_documents>\PowerShell\Microsoft.VSCode_profile.ps1) and remove the following lines:
Import-Module Az.Tools.Predictor
Set-PSReadLineOption -PredictionSource HistoryAndPlugin

PS C:\Users\olav.birkeland\OneDrive\IT\Code> 
o-l-a-v commented 1 day ago

This still happens from time to time. Seems Az.Tools.Predictor + PSReadLine are involved.

I never use Az.Tools.Predictor intentionally, so I just removed it. I also added the following to my profile:

Set-PSReadLineOption -PredictionSource 'History'

Will report back if I still experience this.