Uh oh!
There was an error while loading. Please reload this page.
Fix generic parameter validation in MakeGenericMethod and similar - #1983
Merged
vitek-karas merged 3 commits intoApr 21, 2021
Conversation
…hod. The validator must ignore methods which don't have any requirements. So even if the passed in array doesn't match the method, it needs to not warn in such cases. This is because we can't guarantee we always find the exact method info to work on, instead we compensate by considering potentially multiple candidates. Some of which may not even be generic, or may not have any requirements and so on. In such cases the validator should only warn if there's potentially a real problem - not if the reflection API will fail (that's a non-failure for the validator).
vitek-karas
commented
Apr 21, 2021
MemberAuthor
| bool hasRequirements = false; | ||
| foreach (var genericParameter in genericParameters) { | ||
| if (_context.Annotations.FlowAnnotations.GetGenericParameterAnnotation (genericParameter) != DynamicallyAccessedMemberTypes.None) | ||
| hasRequirements = true; |
marek-safar
approved these changes
Apr 21, 2021
agocke pushed a commit
to dotnet/runtime
that referenced
this pull request
Nov 16, 2022
…tnet/linker#1983) The validator must ignore methods which don't have any requirements. So even if the passed in array doesn't match the method, it needs to not warn in such cases. This is because we can't guarantee we always find the exact method info to work on, instead we compensate by considering potentially multiple candidates. Some of which may not even be generic, or may not have any requirements and so on. In such cases the validator should only warn if there's potentially a real problem - not if the reflection API will fail (that's a non-failure for the validator). Commit migrated from dotnet/linker@190c08c
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 freeto 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.
The validator must ignore methods which don't have any requirements. So even if the passed in array doesn't match the method, it needs to not warn in such cases. This is because we can't guarantee we always find the exact method info to work on, instead we compensate by considering potentially multiple candidates. Some of which may not even be generic, or may not have any requirements and so on. In such cases the validator should only warn if there's potentially a real problem - not if the reflection API will fail (that's a non-failure for the validator).
This should fix the problem in dotnet/runtime#51558 (comment).