-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MSBuild on .NET Core does not allow tasks with same assembly name, but different assembly versions #3572
Comments
Hmm, this repro might not be good because the assembly isn't strong name signed. I suspect desktop is silently reloading old version. Let me update it to strong name sign the assembly... |
Repro fixed to strong name task. Still gives the unexpected behavior on core. |
Huh. This check seems like it'd do it, but I haven't debugged at all |
This may be a limitation of putting all tasks in default assembly load context. |
That's plausible. This throws:
And indeed, from https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md#custom-loadcontext
So I guess we should have a load context per . . . assembly path? |
Yes. More precisely, per UsingTask AssemblyFile path. Dependencies of the task would come into the same load context as the task. This is very much related to the challenges that @natemcmaster outlined here: https://natemcmaster.com/blog/2018/07/25/netcore-plugins/ Many things he has mentioned have bit msbuild loading tasks and roslyn loading analyzers in turn. |
I guess this comes down to more motivation for #1754 |
I'm currently using something similar to https://github.com/AArnott/Nerdbank.MSBuildExtension/blob/master/src/Nerdbank.MSBuildExtension/netstandard1.5/ContextIsolatedTask.cs What popped up on SO was that loading assemblies that are also used by the SDK (newtonsoft.json) are impossible to load (without a custom AssemblyLoadContext to execute your logic). TL;DR having a load context per task assembly in general would be great! (#1754) |
What's the status of this bug? Customers are encountering problems with the build tasks in Grpc.Tools: |
I believe #4916 would address this and planned for 16.5 / sdk 3.1.200, right, @rainersigwald ? |
Correct; I'll close this as a duplicate. |
Duplicate of #1754 |
With desktop MSBuild / VS, we've gotten around issues with node reuse and varying versions of the SDK by increasing the assembly version of the SDK tasks on every build. (Aside: we've regressed that a bunch of times with infrastructure changes.)
However, this does not work on .NET Core. I suspect we haven't noticed this until now because node reuse has only made its way to .NET Core recently.
Steps to reproduce
Run ReproCore.cmd from nguerrera/repros@fc1e1df
WARNING: First step of repro kills msbuild.exe processes, so don't do this with real builds in progress in parallel.
Command line
Expected behavior
Final build command in .cmd succeeds as it does on Desktop (try ReproDesktop.cmd instead).
Actual behavior
Environment data
cc @davkean @rainersigwald @dsplaisted
The text was updated successfully, but these errors were encountered: