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) allocation of an in-bubble type with an out-of-bubble base is treated as side-effect free (hoisted above throwing arg, finalized after base gains a finalizer) #137844
crossgen2's getNewHelper reports pHasSideEffects = false for an in-bubble type whose base class is outside the version bubble, even though that base can later gain a finalizer. The JIT then hoists the allocation above an earlier throwing argument, so once Base gets a finalizer, an object whose constructor never ran is finalized. Reproduces with the default PublishReadyToRun configuration.
Minimal Repro
App.dll is compiled with crossgen2 against Lib v1, then run with Lib v2.
// Lib.dll; v2 is built with V2 definedpublicclassBase{
#if V2~Base()=>System.Console.WriteLine("Base finalized");
#endif
}
In the R2R code for Test, CORINFO_HELP_READYTORUN_NEW is called before the idiv.
Regression?
The bug is reported to also reproduce with .NET 10 PublishReadyToRun; this was not re-verified. It reproduces on main.
Notes
getNewHelper (CorInfoImpl.ReadyToRun.cs) treats an allocation as having side effects only when the allocated type itself is outside the version bubble. A finalizer can also be inherited, so the check should walk the base type chain up to System.Object. #56177 fixed only the case where the allocated type is outside the bubble.
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.
Fix ReadyToRun allocation side effects for versionable base types (do…