Skip to content

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Jul 22, 2025

Error should now call out the invalid runtimeconfig.json (rather than just failing to find a matching version later):

Framework '<name>' is missing a version.
Invalid runtimeconfig.json [<path>]

Resolves #3743

cc @dotnet/appmodel @AaronRobinsonMSFT

@Copilot Copilot AI review requested due to automatic review settings July 22, 2025 03:28
Copy link
Contributor

@Copilot Copilot AI left a 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()

@elinor-fung elinor-fung merged commit 6e14d81 into dotnet:main Jul 25, 2025
147 of 151 checks passed
@elinor-fung elinor-fung deleted the fix3743 branch July 25, 2025 04:17
@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing version in framework reference leads to misleading error

2 participants