You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That populates the static field HttpHandlerResourceV3.CredentialService, preserving a link to the TaskLoggingHelper in an object with a longer lifetime than the task.
The first RestoreTask completes.
MSBuild tears down logging infrastructure required to log messages from the context of the first RestoreTask. Normally this would make $1 eligible for GC, but it's now referenced from a static.
The second RestoreTask is called.
On this pass through, HttpHandlerResourceV3.CredentialService is non-null and not reset to the current TaskLoggingHelper.
The credential provider is invoked and attempts to log (using $1).
MSBuild crashes because of the logging infrastructure teardown from step 5.
The text was updated successfully, but these errors were encountered:
rrelyea
changed the title
Credential providers cause MSBuild crash on second run of RestoreTask
Restore Task cannot be safely run twice in one process (when Credential providers are used)
Oct 25, 2019
Details about Problem
This is the root cause of dotnet/msbuild#4792 and the related .NET Core servicing build failures.
NuGet product used: .NET Core SDK 3.0.100-preview6 in Arcade
NuGet version: 5.2.0.6020
OS version (i.e. win10 v1607 (14393.321)): Windows
Worked before? If so, with which NuGet version: no
Detailed repro steps so we can see the same problem
I experienced this on a repro machine provided by @nkolev92. I don't have a minimized repro but I believe it looks something like this:
RestoreTask
in one project.RestoreTask
in another project.MSB0001: Internal MSBuild Error: ContextID 10 should have been in the ID-to-project file mapping but wasn't!
What's happening here is this:
RestoreTask
creates a new NuGetILogger
wrapping aMicrosoft.Build.Utilities.TaskLoggingHelper
associated with that task invocation -- call this logger$1
.https://github.com/NuGet/NuGet.Client/blob/840b09a4cecda6ae8fd1c07967874fe8061ece63/src/NuGet.Core/NuGet.Build.Tasks/RestoreTask.cs#L103
RestoreTask.ExecuteAsync()
callsDefaultCredentialServiceUtility.SetupDefaultCredentialService
, passing that logger.HttpHandlerResourceV3.CredentialService
, preserving a link to theTaskLoggingHelper
in an object with a longer lifetime than the task.RestoreTask
completes.RestoreTask
. Normally this would make$1
eligible for GC, but it's now referenced from a static.RestoreTask
is called.HttpHandlerResourceV3.CredentialService
is non-null and not reset to the currentTaskLoggingHelper
.$1
).The text was updated successfully, but these errors were encountered: