-
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
Need better logging for the native SDK resolver #15149
Comments
As an example, dotnet/msbuild#5999 is an issue that took me a whole day to figure out, and as a result of that investigation I have emerged with the knowledge that I should have set these three environment variables to influence the SDK resolution process:
Had there been a log entry like "choosing 3.1.100 because the DOTNET_INSTALL_DIR was set explicitly and pointed to a 3.1.100 SDK at C:\msbuild.dotnet" I could have binged an entire season of something wholesome today instead of debugging deep into the SDK resolution. |
Correction, I also had to set |
I don't know if the logging interface currently exposed by MSBuild makes this possible--it's fairly minimal. We might need to augment that first before improving the dotnet resolver. |
@KirillOsenkov Are you saying you need more visibility into what the native hostfxr_resolve_sdk2 method is doing, or what the managed code calling it does with the result? (Or are you not sure?) |
The former, I want to know what decisions the native hostfxr_resolve_sdk2 did and why. Because it's impossible to debug, all I get is a decision, but why it chose that SDK is completely unclear. It should say "used this environment variable" or something. |
And then I guess it's a separate story to thread that output through the managed code so it ends up as an Evaluation message in the binlog |
I think we can try to add some better logging in the managed SDK resolvers first. Then if we can get that piped through, we can try to add additional logging to the native methods to include. |
It’s a good plan |
Folks, this issue is supremely painful. Here's the error that I get:
I'm literally left stranded and helpless. Every time I investigate this, I end up spending a few hours debugging deep into the SDK, but if I'm a regular user, I'm just absolutely helpless. We really need to invest into improving this experience. Please @marcpopMSFT @KathleenDollard @dsplaisted |
FYI, it's not visible in GH but we've put this in our .net 6 backlog pipeline. That puts it behind our .net 6 committed work but ahead of the other 1600 issues we have. There is no commitment when we'll do this but we'll likely start looking at that list closer to the end of .net 6 timeframe and maybe slot in some of the items listed before .net 6 ships. |
As long as it’s on the radar and being tracked, I’m happy :) |
This bit me while figuring out #24512. Logging the path it's trying to check would be a good next step. |
Wasted a couple hours of my life on this again today. |
#26904 should help with this. It doesn't directly surface messages from the native resolver, but you can see a lot of what is going into it and coming back out. It's also possible to set environment variables to get logs from the native resolver: https://learn.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing#how-do-i-debug-the-probing-properties-construction |
It's great to have some developments here. Having to set environment variables to obtain logs is a huge UX hurdle. Nobody will even know about these. Any reason these can't be on by default? Also the last time I was looking, SdkLogger was not used for anything: |
I'd like to be able to include the messages from the native logger in the resolver failure logs. We'd need to update the native hostfxr code for that, and there might be a perf impact to always generating those messages. For now we're hoping that the #26904 is a big step forward, and some time after that's gone in we can assess what further improvements we should make. |
Should I file a new issue to improve the error message for MSB4236? Currently it says: It doesn't say:
I can imagine a better text: Also if possible consider grouping these and only show once instead of per-project (if building a solution). Chances are you will have one per project, so a hundred of these same errors for a hundred project solution. Long term ideally there should be |
@KirillOsenkov that error is for resolving the sdk that's at the top of a project file, not the .NET SDK. Reading through the history here, I'm not sure if you're original issue was about finding the .NET SDK or resolving an sdk as later comments were more about the latter but your original description was about the former. The PR that Daniel linked will help with the latter. |
I didn’t realize they’re different! If I’m confused, imagine how our users will be confused. The error message needs to improve either way. |
long sad story |
Got another difficult to diagnose issue today with this build failure:
The error message incorrectly implies that the directory |
These should help:
|
I don't see a way to debug/investigate the decision process of the SDK resolver native .dll.
I've gotten as far as
sdk/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolverNativeWrapper.cs
Lines 21 to 23 in 917b98c
but from then on it's a black box and I don't see anything that would explain the resulting SDK that comes out of it. I want to know what factors influenced the decision:
The resolver should explain its choice and clearly communicate which factors made a difference and which didn't. Otherwise I have to resort to cargo culting it and so far unsuccessfully.
The text was updated successfully, but these errors were encountered: