[release/8.0-staging] Add a parent check to the forward substitution tree walk by github-actions[bot] · Pull Request #116240 · dotnet/runtime

Backport of #99546 to release/8.0-staging

/cc @AndyAyersMS @SingleAccretion

Customer Impact

  • Customer reported
  • Found internally

JIT crash reported in #116180

Related to calling methods that return values and then ignoring those return values.

Regression

  • Yes
  • No

Not 100% sure, but seemingly a hard to hit bug that's been there a while. This phase was first added in .NET 7.

Testing

Verified the fix on the repro case in the issue.

Risk

Low. Fix was added to .NET 9 before release.