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
{{ message }}
Repository navigation
Crossgen: (bug) static virtual resolved to an inherited generic base method gets the derived type as its generic context #137845
crossgen2 can resolve a constrained call T.M() to a static method inherited from a generic base class (Base<string>.M). In that case it passes the constrained type's dictionary (Derived<int>) as the instantiation argument instead of the owning type's dictionary (Base<string>). As a result, R2R code reads the wrong type argument.
If Derived is non-generic (class Derived : Base<string>), a Checked runtime asserts instead: numGenericArgs > 0 in ProcessDynamicDictionaryLookup (prestub.cpp).
Regression?
Reproduces with crossgen2 10.0.14, 11.0.0-rc.3, and main. It is not a recent regression.
Notes
For a non-DIM resolution, ceeInfoGetCallInfo (CorInfoImpl.ReadyToRun.cs) sets exactType = constrainedType even when the resolved method is declared on a base type. The inst param lookup then becomes TypeDictionary(Derived<int>). The VM uses GetExactDeclaringType, and ILC uses directMethod.OwningType. crossgen2 should also use the exact owning type, Base<string>.
Activity
dotnet-policy-service commentedon Nov 19, 2026
Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.