-
Notifications
You must be signed in to change notification settings - Fork 510
Microsoft.Extensions.DependencyInjection.Abstractions.dll already loaded due to Omnisharp dependencies #2292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Extensions.DependencyInjection.Abstractions.dll already loaded due to Omnisharp dependencies #2292
Comments
@bgelens are you able to drill into the error? Like @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. |
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 |
Hmmm ok that's definitely a problem. What does the lowest level error look like under |
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 |
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. |
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 |
Just discussed this with @daxian-dbw. It's a hard problem to solve, but we think we might be able to fix it in this case:
|
Ok this is a bit more complicated because of needing to support multiple .NET runtimes. Playing with it a bit I think we need:
|
@rjmholt I suggest you to look into
Could you please explain why is that? |
Perhaps I'm conflating unloadable assemblies with assembly load contexts, but was under the impression that this was a .NET Core 3.0 feature. |
One gotcha of using |
I've added a similar (but smaller) change in the .NET Framework side to use However, if there are other suggestions, I'd be very happy to try them, since documentation on this kind of loading (especially when we don't control the exe) is scant. |
It looks that the M.E.D.A.dll required by Az.Resource is a lower version than the one depended by PSES. Is that always the case? If the higher version of the dll is loaded first, the requesting for loading the lower version later should just work ... |
It's certainly not something we can always guarantee for all modules. I'm also worried that a binding redirection like that depends on no breaking changes across versions. In the case of this assembly, there's been a major version change, so I'd be skeptical about API stability there. However, if it turns out my solution has some serious issue, we can try something simpler like this in-code binding redirect. |
There was some change made in Core that broke some of that. I've even had it throw that specific error message when attempting to load the exact same assembly. Not even in a different location, the exact same assembly in the exact same place. |
Ok here's a demo to try of what I've got so far. It's got some extensive changes in it, so I'm expecting something to go pear shaped, but the following should be the case:
(Sorry about the zip, GitHub won't take a .vsix file directly) |
I reviewed that and only added code to only run it when PSRL is enabled, but will review. Have had PSRL running myself in Win and *nix so far without issue, but will look into it. |
IIRC, the issue only showed up when launching the debug server. |
@PrzemyslawKlys I'm trying out things like F5 here. Is there anything else I should try perhaps?
This is especially odd, since that log call is the last thing that happens in the |
For this issue: #2289 You can try this code: $Testor = for ($i = 0; $i -lt 10; $i++) {
$Tes2 = for ($h = 0; $h -lt 10; $h++) {
'test'
}
$Tes2
'test'
}
$Testor In old version if you cancel debugging it doesn't return everything to screen. In new version it does. For moved cursor problem: Notice how on first run the first line is moved to the right. For the problem you're reffering to i guess it's non-existent. After cleaning up VScode from earlier versions and making sure any old PS Extensions doesn't exists it seems to work. |
Ok, thanks! I'll keep looking into it |
Worked with it for over an hour yesterday. Than intellisense froze and the IC didn't except any input anymore (No chars, no enter, no ctrl+c, nothing). Was working so switched to stable extension again. I'll see if I can repro again in future when I have some time in the day and hopefully can capture some logs |
Sounds like a deadlock. Hard to debug on macOS (due to limitations in .NET Core...) unless you've got the source locally |
I've got this running as my default environment now, so hopefully I'll hit it and be able to resolve it. The other possibility is that it's the old deadlock from PackageManagement, which should be fixed in the latest PackageManagement version. |
But if you hit that again, just let me know what you were doing/running at the time |
@rjmholt did you manage to fix the psreadline problem? I've stopped using preview due to that bug. |
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. |
Same issue on new version. |
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 |
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
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. |
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. |
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 |
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. |
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. @PrzemyslawKlys, since you're on Windows, if you're able to collect a proc dump with |
It's not related so I'm happy to open another issue but basically the same issue @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 |
1575758373-d03e9f29-442a-4ccf-999a-f6b8c03654d31575758309039.zip Here's a new log, completions stopped working again. |
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
Loaded Modules:
Trying to load Az.Resources
The text was updated successfully, but these errors were encountered: