Fix nullability analysis of property indexers#126835
Open
lilinus wants to merge 2 commits intodotnet:mainfrom
Open
Fix nullability analysis of property indexers#126835lilinus wants to merge 2 commits intodotnet:mainfrom
lilinus wants to merge 2 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect NullabilityInfoContext results for indexer parameters by ensuring indexer parameter nullability is read from the appropriate accessor (getter/setter) parameter metadata, and adds regression coverage for the reported tuple-property interaction.
Changes:
- Update
NullabilityInfoContext.Create(ParameterInfo)to remap indexerParameterInfofromPropertyInfoto the corresponding getter/setter parameter. - Add tests covering indexers with and without an additional value-tuple-returning property (regression scenario).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/NullabilityInfoContextTests.cs | Adds regression tests validating indexer parameter nullability states, including the tuple-property scenario. |
| src/libraries/System.Private.CoreLib/src/System/Reflection/NullabilityInfoContext.cs | Fixes indexer-parameter handling by switching to accessor parameters and respecting nullablePublicOnly behavior. |
...s/System.Runtime/tests/System.Runtime.Tests/System/Reflection/NullabilityInfoContextTests.cs
Show resolved
Hide resolved
This was referenced Apr 13, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #101071