Repository navigation
Closed
PowerShell/PowerShellEditorServices
#1118Labels
Description
I'm running 2019.11.1 (the out of band fix for the @ problem #2274 ) and cannot import Az.Resources anymore as a dll is already loaded. It still imports fine outside of the integrated terminal so I'm curious if something changed in this release that might cause this?
PSVersion
Name Value
---- -----
PSVersion 7.0.0-preview.5
PSEdition Core
GitCommitId 7.0.0-preview.5
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Loaded Modules:
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest 7.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Credential, Get-ExecutionPolicy…}
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script 2.0.325 oh-my-posh {Get-ComputerName, Get-Drive, Get-FullPath, Get-ShortPath…}
Script 0.7.3 posh-git {Add-PoshGitToProfile, Add-SshKey, Enable-GitColors, Expand-GitCommand…}
Script 0.2.0 PowerShellEditorServices.Commands {ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent, Find-Ast, Get-Token…}
Binary 0.2.0 PowerShellEditorServices.VSCode {Close-VSCodeHtmlContentView, New-VSCodeHtmlContentView, Set-VSCodeHtmlContentView, Show-VSCodeHtmlContentView…}
Script 2.0.0 beta5 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}
Trying to load Az.Resources
�[1;32mException : �[0m
�[1;32mMessage : �[0mAssembly with same name is already loaded
�[1;32mTargetSite : �[0m
�[1;32mName : �[0mBind_LoadAssemblies
�[1;32mDeclaringType : �[0mSystem.Management.Automation.Runspaces.InitialSessionState
�[1;32mMemberType : �[0mMethod
�[1;32mModule : �[0mSystem.Management.Automation.dll
�[1;32mStackTrace : �[0m
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)
�[1;32mSource : �[0mSystem.Management.Automation
�[1;32mHResult : �[0m-2146232799
�[1;32mCategoryInfo : �[0mInvalidOperation: (:) [Import-Module], FileLoadException
�[1;32mFullyQualifiedErrorId : �[0mFormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
�[1;32mInvocationInfo : �[0m
�[1;32mMyCommand : �[0mImport-Module
�[1;32mScriptLineNumber : �[0m1
�[1;32mOffsetInLine : �[0m1
�[1;32mHistoryId : �[0m20
�[1;32mLine : �[0mipmo az.resources
�[1;32mPositionMessage : �[0mAt line:1 char:1
+ ipmo az.resources
+ ~~~~~~~~~~~~~~~~~
�[1;32mInvocationName : �[0mipmo
�[1;32mCommandOrigin : �[0mInternal
�[1;32mScriptStackTrace : �[0mat <ScriptBlock>, <No file>: line 1
Reacted by Carlo Cardella and Andy Jordan
Activity
rjmholt commentedon Nov 7, 2019
Ben Gelens (@bgelens) are you able to drill into the error? Like
$error[0].Exception.InnerException | fl -f *type of thing? If there's an indicator of what assembly isn't loading that would help.Przemysław Kłys (@PrzemyslawKlys) raised that there might be an issue with the layout of that VSIX, so it might be an issue with how I built it.
bgelens commentedon Nov 7, 2019
There is no InnerException 🤷♂ I removed the vsix installed version and moved back to 2019.11.0 preview and I have the same issue.
Switching to non-preview and the import is successful. I'll see if I can find some more info
rjmholt commentedon Nov 7, 2019
Hmmm ok that's definitely a problem. What does the lowest level error look like under
fl * -f?bgelens commentedon Nov 7, 2019
Removing these from Az.Resources Manifest RequiredAssemblies allows for the import
Still trying to pinpoint the exact dll's.. I removed 1 by 1 already but that didn't work so it's a combination
rjmholt commentedon Nov 7, 2019
Looks like it's Primitives + DI.Abstractions -- the Omnisharp LSP library depends on them.
We'll need to investigate a workaround for the dependency hell issue. We've already discussed pushing the LSP work into another thread or process in a different issue, but that was also deemed to be too breaking due to argument completers and static class bits not working.
[-]Preview 2019.11.1 cannot load Az.Resources[/-][+]Microsoft.Extensions.Primitives already loaded due to Omnisharp dependencies[/+]bgelens commentedon Nov 7, 2019
I've pinpointed to these 2:
Leaving in Primitives will not block the import
I need to move off preview as I'm working with the Az modules every day. LMK if I can assist in debugging / previewing fixes
[-]Microsoft.Extensions.Primitives already loaded due to Omnisharp dependencies[/-][+]Microsoft.Extensions.DependencyInjection.Abstractions.dll already loaded due to Omnisharp dependencies[/+]rjmholt commentedon Nov 7, 2019
Just discussed this with Dongbo Wang (@daxian-dbw). It's a hard problem to solve, but we think we might be able to fix it in this case:
rjmholt commentedon Nov 7, 2019
Ok this is a bit more complicated because of needing to support multiple .NET runtimes.
Playing with it a bit I think we need:
daxian-dbw commentedon Nov 7, 2019
Rob Holt (@rjmholt) I suggest you to look into
Assembly.LoadFile. An assembly loaded byAssembly.LoadFileis always loaded in to a separate load context, both on .NET and .NET Core.Could you please explain why is that?
47 remaining items
PrzemyslawKlys commentedon Dec 5, 2019
Rob Holt (@rjmholt) did you manage to fix the psreadline problem? I've stopped using preview due to that bug.
rjmholt commentedon Dec 5, 2019
I didn't hit it myself (and included code to make legacy readline not hit it). But the issue as you see it might be caused by my local module versions in the build if you don't have your own PSReadLine installation. I've refreshed them, but now the module is bigger than 10MB, so you'll have to grab it from here.
PrzemyslawKlys commentedon Dec 5, 2019
Same issue on new version.
bgelens commentedon Dec 5, 2019
Rob Holt (@rjmholt)
I've got PackageManagement 1.4.5 which is the latest (ships with PSv7 Preview 6)
I'm mainly developing modules, running builds which, as a step in the builds, standup local ps repositories to generate nupkg and then remove them again. The rest is a lot of run selection (f8)
I do have a couple of Azure DevOps feeds registered as well which PowerShellGet is not handling all that well but that is another issue all together I think.
I've switched to your build again and will run it during the day tomorrow. Will let you know how it goes
rjmholt commentedon Dec 5, 2019
If you have a PSReadLine module installed locally, you should make sure you upgrade it to 2.0.0-beta.6. You can find the version with
gmo -list PSReadLine. As I say, I haven't been able to reproduce it locally.Understood, and thanks for giving it a go. It's entirely possible I've goofed in some thread handling, so hopefully if that's the case we can find it.
I've never done this, but it might be possible to collect a core dump on a deadlock using tools like in this blog post and this stack overflow answer.
PrzemyslawKlys commentedon Dec 5, 2019
Updated psreadline for PS5 / PS 6 and it works. The one that was installed was beta 3.
It would seem packed version is beta 3, not beta 6. Now it doesn't error out.
rjmholt commentedon Dec 5, 2019
The packed version I show is beta 5, but this suggests our logic to prevent picking up PSReadLine could be flawed.
My hope is that PSReadLine isn't loaded to early for us to make sure the right one is there.
bgelens commentedon Dec 6, 2019
It froze again. This time I worked a lot longer in it. At the time of freeze, I see these in the EditorServices.log (a couple of times). Sorry for redaction but don't want to include customer hints
There are some hardcoded paths in there that might be part of the issue. Also untitled-1 is not on disk, just in memory, never saved it.
The end of my log looks like this:
So the freeze occurred around 11:16, so the extension is still trying to do thing at 11:21 and even now at 11:30 it is still writing
Finding descriptor for $/cancelRequestPrzemyslawKlys commentedon Dec 6, 2019
I actually saw something similar. I pressed F5, nothing happened, I pressed F5 5 times and nothing happened, after 1 minute everything just started working.
rjmholt commentedon Dec 7, 2019
Ah, the hardcoded paths are because error site hints are baked in at compile time. Since it was built on my machine, you're seeing details based on where I built it.
The Fatal log entry is interesting; implies it's a crash, but the server has kept on going. The fatal log entry there looks like it's a bug in how we handle untitled files unrelated to this change (TylerLeonhardt was suspecting this issue might predate my changes, so it might be unrelated).
Thanks for the info both! Still not sure that the freeze is this crash or something else, but with more use we should be able to get to the bottom of it.
Przemysław Kłys (@PrzemyslawKlys), since you're on Windows, if you're able to collect a proc dump with
procdump -ma <pid>where<pid>is the PID of the powershell.exe (or pwsh.exe) hosting PSES and send it through next time you hit a freeze, we might be able to work out where the issue lies. You'll probably have to email us a one drive link or similar, since it'll be big.PrzemyslawKlys commentedon Dec 7, 2019
It's not related so I'm happy to open another issue but basically the same issue Ben Gelens (@bgelens) is having. That completions stop working after a while:
Basically types completion doesn't work for most of the types. Some stuff continues to work (maybe from cache tho).
1575721182-36158a29-cf42-4a53-9043-f84c4e9d58391575721180675.zip
PrzemyslawKlys commentedon Dec 7, 2019
1575758373-d03e9f29-442a-4ccf-999a-f6b8c03654d31575758309039.zip
Here's a new log, completions stopped working again.
PrzemyslawKlys commentedon Dec 8, 2019
Just wanted to add:
With preview extensions after completions stop working usually a restart of PowerShell hangs vscode.