-
Notifications
You must be signed in to change notification settings - Fork 253
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
RestoreCollectorLogger
logging into EvaluationLoggingContext
after evaluation finished
#12744
Comments
RestoreCollectorLogger
logging into EvaluationLoggingContext
after evaluation finished
My hunch is that some code path during NuGet SDK resolution "forks" and goes asynchronous, while the rest of MSBuild evaluation resumes, assuming that's done, and eventually evaluation completes and invalidates the logging context, while that code path that throws is still in flight. |
Potentially related? dotnet/msbuild#8639 |
I dug in some more, and I'm seeing |
On the MSBuild side, the stack that starts in evaluation and calls into SdkResolver is:
This is what's blocking on the result task:
|
Team triage: @jeffkl could you take a look at this bug and evaluate the priority? |
@jeffkl the repro is a bit involved, and I’m on vacation this week, but I’d be happy to pair with you on this next week or after. It’s not blocking. |
NuGet Product Used
MSBuild.exe
Product Version
msbuild.exe 17.6.3+07e294721 for .NET Framework
Worked before?
not a regression
Impact
Other
Repro Steps & Context
During evaluating MSBuild projects in the IDE we see exceptions under debugger where
RestoreCollectionLogger
is attempting to log into anEvaluationLoggingContext
which is no longer valid.The exception is:
This line invalidates the logging context after evaluation finishes for a project:
https://github.com/dotnet/msbuild/blob/4598629a2493ed6b366ab00d595ecd53a3164b60/src/Build/BackEnd/Components/Logging/EvaluationLoggingContext.cs#L42
The chain of loggers is as follows.
Evaluation -> ResolveSdk(EvaluationLoggingContext) -> new SdkLogger(EvaluationLoggingContext) -> new SdkResolverContext(SdkLogger) -> NuGetSdkResolver.Resolve() -> new NuGetSdkLogger(SdkResolverContext.SdkLogger)
ResolveSdk
to resolve an SDK such as Arcade, it passes theEvaluationLoggingContext
which will be later invalidated after the project evaluation finishesResolveSdk
callsnew SdkLogger(EvaluationLoggingContext)
: https://github.com/dotnet/msbuild/blob/4598629a2493ed6b366ab00d595ecd53a3164b60/src/Build/BackEnd/Components/SdkResolution/SdkLogger.cs#L22new SdkResolverContext
is created and passed theSdkLogger
NuGetSdkResolver.Resolve()
is called and passed theSdkResolverContext
new NuGetSdkLogger
is created and passed theSdkResolverContext.SdkLogger
: https://github.com/NuGet/NuGet.Client/blob/b3c4e8094bbb924408180d700ae5b3d37713587c/src/NuGet.Core/Microsoft.Build.NuGetSdkResolver/NuGetSdkLogger.cs#L42...
(at some point later, it's unclear when or how)
...
RestoreCollectorLogger
is passed theinnerLogger
which is theNuGetSdkLogger
, which internally points to theSdkLogger
, which in turn uses theEvaluationLoggingContext
I'm guessing after some retries or network latencies the
RestoreCommand
callsRestoreCollectorLogger.Log
, which calls_innerLogger.Log
here, which in turn throws:https://github.com/NuGet/NuGet.Client/blob/b3c4e8094bbb924408180d700ae5b3d37713587c/src/NuGet.Core/NuGet.Commands/RestoreCommand/Logging/RestoreCollectorLogger.cs#L149
After debugging for a while, I stopped being able to reproduce this, presumably because of the caches? Afraid to clear the caches now because I have some unrelated valuable context there, but hopefully by reasoning you can figure out under what circumstances the RestoreCollectorLogger can continue logging after the project evaluation that triggered the Sdk resolution completes.
Verbose Logs
No response
The text was updated successfully, but these errors were encountered: