Add searched .NET install locations to error message#117796
Merged
elinor-fung merged 2 commits intodotnet:mainfrom Jul 21, 2025
Merged
Add searched .NET install locations to error message#117796elinor-fung merged 2 commits intodotnet:mainfrom
elinor-fung merged 2 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the error messaging when the .NET host cannot find a .NET installation by adding detailed information about which locations were searched during the discovery process.
Key changes:
- Modified
get_dotnet_root_from_envto clear the environment variable name when no valid path is found - Enhanced error message generation in
fxr_resolver.cppto include a comprehensive list of searched locations - Added a new test case to verify the improved error message format
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/native/corehost/hostmisc/utils.cpp |
Modified to clear environment variable name when dotnet root is not found |
src/native/corehost/fxr_resolver.cpp |
Enhanced error message generation with detailed search location information |
src/native/corehost/corehost.cpp |
Removed redundant error logging since detailed error is now handled elsewhere |
src/native/corehost/apphost/standalone/hostfxr_resolver.cpp |
Added error message for non-fully-qualified hostfxr paths |
src/installer/tests/HostActivation.Tests/InstallLocation.cs |
Added test case to verify new error message format |
Comments suppressed due to low confidence (1)
src/native/corehost/fxr_resolver.cpp:162
- [nitpick] The variable name 'searched_locations' could be more descriptive. Consider renaming it to 'search_details_message' or 'location_search_summary' to better indicate it's building an error message.
pal::string_t searched_locations = _X("The following locations were searched:");
Contributor
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
jkoritzinsky
approved these changes
Jul 18, 2025
… clearing on failure
AaronRobinsonMSFT
approved these changes
Jul 18, 2025
This was referenced Jul 19, 2025
Open
Member
Author
|
/ba-g #117811 and timeout in leg unaffected by this change (libraries tests linux_musl) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Include searched locations in error message when host cannot find a .NET install (
hostfxr)Example - the 'following locations were searched' section is new:
Resolves #116108
cc @dotnet/appmodel @AaronRobinsonMSFT