dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

[Feature Request]: Log the results of SDK resolution through a Logger #9413

Closed baronfel closed 10 months ago

baronfel commented 1 year ago

Summary

The SdkResolverService currently logs when it is about to resolve SDKs, but it never logs the results of resolving SDKs - this can make it difficult to use binlogs to diagnose SDK resolution problems, since the only other option is to gather ETW traces, which is not always doable.

Background and Motivation

While helping @jaredpar with https://github.com/jaredpar/complog/pull/73 we found this gap in the binlogs, which was a major head-scratch moment.

Proposed Feature

MSBuild should log the final results of SDK resolution to the logger in some form - ideally more than just errors would be logged because sometimes the SDK resolution result itself can be outside of what the user is expecting.

Alternative Designs

No response

rainersigwald commented 1 year ago

I might go so far as to say that all the SDK resolution diagnostics should be preserved in the binlog, including the failure reasoning from other resolvers. This shouldn't be too noisy since they'll all be cached . . .

But even if we don't do that we should put in the binlog as much as goes into the ETW

https://github.com/dotnet/msbuild/blob/9a0cef6f75bf13ffbbde956b8f7d7ad7d6e0d996/src/Build/BackEnd/Components/SdkResolution/SdkResolverService.cs#L349