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
JIT: (bug) R2R/NativeAOT skip covariant array store check for different instantiations of a sealed generic class #134889
In R2R/NativeAOT shared generic code, the JIT drops the covariant array store check when storing G<U> into a G<T>[]. This lets a G<object> be stored into a G<string>[], which breaks type safety.
Codegen for Test[__Canon,__Canon] calls CORINFO_HELP_ASSIGN_REF instead of CORINFO_HELP_ARRADDR_ST. Plain JIT (DOTNET_ReadyToRun=0) is correct.
Regression?
Yes, regression in .NET 10. .NET 8.0 and 9.0 are correct. .NET 10.0, 11.0-rc2 and main are wrong (both R2R and NativeAOT).
Notes
gtCanSkipCovariantStoreCheck treats isExactType(G<__Canon>) && valueHandle == arrayElementHandle as proof of type safety. In shared code both handles are G<__Canon>, but the runtime types differ. crossgen2/ILC report sealed canonical types as exact.
Activity
dotnet-policy-service commentedon Sep 29, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: don't skip covariant store check for shared sealed element types (…