You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was discovered when trying to add GENERIC_PARAMETER_ATTRIBUTE_ACCEPT_BYREFLIKE_CONSTRAINTS check for override methods. Other generic parameter checks are probably not in place either.
One possible place to add this check is mono_class_setup_vtable_general - where it calls mono_metadata_signature_equal (cmsig, m1sig).
Should also consider methods of interfaces too.
The text was updated successfully, but these errors were encountered:
So the general issue is that if you have some parent class or an interface with a generic method M<T>(...) where T : ConstraintClass (or a special constraint like new,struct, etc) and a subclass also implements M<T>(...) but leaves out the constraint (or uses a constraint that doesn't match), mono will just accept that.
(Note you need to write the code in IL - Roslyn rejects unsatisfied constraints in C#). The correct behavior is to fail the class.
There are three cases (possibly more):
a subclass tries to override an ancestor class's method but doesn't have the right constraints
a class or interface implicitly implements an interface's method but doesn't have the right constraints
a class or interface explicitly implements an interface's method but doesn't have the right constraints.
It's all in mono_class_setup_vtable_general but in different loops
This issue was discovered when trying to add
GENERIC_PARAMETER_ATTRIBUTE_ACCEPT_BYREFLIKE_CONSTRAINTS
check for override methods. Other generic parameter checks are probably not in place either.One possible place to add this check is
mono_class_setup_vtable_general
- where it callsmono_metadata_signature_equal (cmsig, m1sig)
.Should also consider methods of interfaces too.
The text was updated successfully, but these errors were encountered: