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) Tier0: ArgumentNullException.ThrowIfNull(Nullable<T>, paramName) evaluates paramName before reading the source #137639
At Tier0, ArgumentNullException.ThrowIfNull(s.Field, names[idx]) with a Nullable<T> source reads hasValue only after paramName is evaluated, so the exception from names[idx] is thrown instead of the NullReferenceException from the (null) source byref. Optimized code throws NullReferenceException.
Compiler::impThrowIfNull (importercalls.cpp), nullable case: only the box-helper address and paramName are spilled; the hasValue read happens later in the QMARK condition, i.e. after paramName is evaluated.
The non-nullable CORINFO_HELP_BOX case emits gtNewNullCheck(addr) between the two spills; the nullable case lacks the equivalent.
Only exception ordering is affected: paramName must have a non-call exceptional side effect (range check, division, cast, ...) and the source byref must be null.
Activity
dotnet-policy-service commentedon Nov 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: Read Nullable hasValue before paramName in Tier0 ThrowIfNull
JIT: Read Nullable hasValue before paramName in Tier0 ThrowIfNull (do…