Fix Type.IsVisible and Type.ContainsGenericParameters for function pointers#122224
Merged
stephentoub merged 11 commits intomainfrom Dec 7, 2025
Merged
Fix Type.IsVisible and Type.ContainsGenericParameters for function pointers#122224stephentoub merged 11 commits intomainfrom
stephentoub merged 11 commits intomainfrom
Conversation
…rameters Co-authored-by: jkotas <[email protected]>
Co-authored-by: jkotas <[email protected]>
Copilot
AI
changed the title
[WIP] Fix Type.IsVisible and Type.ContainsGenericParameters for function pointers
Fix Type.IsVisible and Type.ContainsGenericParameters for function pointers
Dec 5, 2025
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-reflection |
Member
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes bugs in the abstract implementations of Type.IsVisible and Type.ContainsGenericParameters that caused incorrect results for function pointer types in NativeAOT.
Key Changes:
- Added function pointer handling to
ContainsGenericParametersto check return and parameter types - Added function pointer handling to
IsVisibleto validate visibility of return and parameter types - Added comprehensive test coverage for function pointer visibility scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs | Adds function pointer checks to ContainsGenericParameters and IsVisible properties to recursively validate return and parameter types |
| src/libraries/Common/tests/System/FunctionPointerTests.cs | Adds FunctionPointerVisibility test with scenarios for public/private return types and parameters, plus supporting test fields in FunctionPointerHolder |
jkotas
reviewed
Dec 5, 2025
Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Dec 6, 2025
Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Dec 7, 2025
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs
Outdated
Show resolved
Hide resolved
…/Type/TypeTests.cs
…o inherit from Type directly Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Dec 7, 2025
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs
Outdated
Show resolved
Hide resolved
…ericParameters Co-authored-by: jkotas <[email protected]>
jkotas
approved these changes
Dec 7, 2025
This was referenced Dec 7, 2025
Open
stephentoub
reviewed
Dec 7, 2025
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs
Show resolved
Hide resolved
stephentoub
approved these changes
Dec 7, 2025
This was referenced Dec 8, 2025
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.
Type.IsVisibleandType.ContainsGenericParametersdon't handle function pointers correctlyContainsGenericParametersin Type.Helpers.cs to check function pointer return and parameter typesIsVisiblein Type.Helpers.cs to check function pointer return and parameter typesOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.