-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Print specific error when framework in runtimeconfig.json is missing a version #117914
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves error reporting in the .NET runtime host when framework entries in runtimeconfig.json files are missing required properties (name or version). Instead of generic failure messages, the host now provides specific error messages indicating which framework property is missing and identifies the problematic configuration file.
- Enhanced native code error handling to detect missing framework name/version properties earlier
- Added specific error messages for missing framework names and versions
- Improved robustness of test assertion helpers and added comprehensive test coverage
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/corehost/runtime_config.cpp | Added explicit validation for missing framework name/version with specific error messages |
| src/native/corehost/fxr/hostfxr.cpp | Added validation to output "Invalid runtimeconfig.json" message when config parsing fails |
| src/installer/tests/TestUtils/RuntimeConfig.cs | Made Framework.ToJson() method public to support test assertions |
| src/installer/tests/TestUtils/Assertions/CommandResultAssertions.cs | Fixed null reference issues in string contains assertions |
| src/installer/tests/HostActivation.Tests/NativeHostApis.cs | Added test for missing framework version in API scenarios |
| src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs | Enhanced tests for missing framework name/version with specific error message validation |
| src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs | Added comprehensive tests for missing framework properties in app launch scenarios |
Comments suppressed due to low confidence (1)
src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs:328
- The removal of
.MultilevelLookup(false)changes the test behavior and may affect the test's reliability. This line was likely present to ensure consistent test execution by disabling multilevel lookup. Consider whether this removal was intentional or if it should be retained to maintain test isolation.
command.EnableTracingAndCaptureOutputs()
Error should now call out the invalid runtimeconfig.json (rather than just failing to find a matching version later):
Resolves #3743
cc @dotnet/appmodel @AaronRobinsonMSFT