Skip to content

Fix issue with covariant return method validation #41703

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

Merged

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Sep 1, 2020

The ClassLoader::ValidateMethodsWithCovariantReturnTypes was being called
from a place where the relevant types were sometimes not fully loaded yet.
That resulted in an attempt to load the type being loaded recursively,
which was detected and the TypeLoadException was thrown.
This change fixes it by moving the call to the
ClassLoader::ValidateMethodsWithCovariantReturnTypes to the PushFinalLevels
when the level is greater than CLASS_LOAD_EXACTPARENTS, which is the
last stage of normal loading.

The ClassLoader::ValidateMethodsWithCovariantReturnTypes was being called
from a place where the relevant types were sometimes not fully loaded yet.
That resulted in an attempt to load the type being loaded recursively,
which was detected and the TypeLoadException was thrown.
This change fixes it by moving the call to the
ClassLoader::ValidateMethodsWithCovariantReturnTypes to the PushFinalLevels
when the level is greater than CLASS_LOAD_EXACTPARENTS, which is the
last stage of normal loading.
@janvorli janvorli added this to the 5.0.0 milestone Sep 1, 2020
@janvorli janvorli self-assigned this Sep 1, 2020
Copy link
Member

@davidwrighton davidwrighton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks like a correct fix.

@janvorli janvorli merged commit 10b262b into dotnet:master Sep 2, 2020
@janvorli
Copy link
Member Author

janvorli commented Sep 2, 2020

/backport to release/5.0-rc2

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2020

Started backporting to release/5.0-rc2: https://github.com/dotnet/runtime/actions/runs/236120186

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.

2 participants