-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ProjectLoadContext cannot be used to load project which references Newtonsoft.Json 8 #5756
Comments
cc @anurse @davidfowl @NTaylorMullen here is a standalone for what we were discussing in person. May have something to do with TPA, but then again, "Microsoft.Extensions.Primitives" is in the TPA and it gets loaded just fine. |
Does that version differ between the two projects? Because as long as they are the same, it would work fine. The problem is that Newtonsoft.Json is in the TPA list AND the versions differ. |
Could be. Might explain why ProjectContextLoader.Load() gets called to load "Microsoft.Extensions.Primitives" but never gets called on to load Newtonsoft.Json. |
Funny thing is if we reverse the version (e.g. "Loader" uses 8 and "Library" uses 7) the error goes away and user code loads and executes, but ProjectContextLoader.Load() still isn't called to load Newtonsoft.Json. |
Since this is targeted to Tooling RTM, I'm going to unassign myself so it can be re-triaged. I am going to be submitting a fix for #5602 shortly, but this one requires a bit of exploration still and I'm not sure I'll have the bandwidth as I transition back to ASP.NET stuff :). If it needs to come back to me, so be it, but I want to clarify the timeline and plan for this one since it is currently targeting Tooling RTM. /cc @muratg @piotrpMSFT for re-examination. It might be good to sync up with @natemcmaster on what the status of this is post RC2/Preview1. |
I believe this has been fixed by changes in CoreCLR dotnet/coreclr#5144. I verified that TPA assemblies can be overriden by a load context now. |
Steps to reproduce
Standalone repo: Archive.zip
What this repro does:
There are two independency projects, "Library" and "Loader".
"Loader" attempts to use
Microsoft.DotNet.ProjectModel.ProjectLoadContext
to load the "Library" assembly and instantiateLibrary.Banana
via reflection.Loader uses Newtonsoft.Json 7.0.0.
Library uses Newtonsoft.Json 8.0.0.
(For the purposes of the repro, I modified ProjectLoadContext to include a callback to log when assemblies are being loaded.)
Expected behavior
ProjectLoadContext.Load()
should be called on to load "Newtonsoft.Json".Evidence:
Program output:
Actual behavior
ProjectLoadContext.Load()
is never called to load "Newtonsoft.Json"Program output:
Environment data
dotnet --info
output:The text was updated successfully, but these errors were encountered: