[release/8.0-staging] Fix Type System Equivalence Checks #106667
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #106498 to release/8.0-staging
/cc @steveisok @ivdiazsa
Customer Impact
A customer found a considerable slowdown in their WinForms App when enabling ReadyToRun, as described on issue #96242. Upon investigation, we found that certain methods that were supposed to be precompiled were getting ignored and being deferred to the JIT. This was caused by a new feature added in .NET 8 to add support for type equivalence checks under certain scenarios. However, these checks were interfering in use cases where they were not needed, like our customer's app in this case.
Regression
Pull Request: #87899
Testing
Crossgen2 threw an error only viewable through verbose output but did not crash. Tested the fix manually for multiple scenarios ensuring that said error was no longer present. The resulting R2R image also had a larger size, which confirms the method was successfully compiled, as opposed to before implementing the fix.
Risk
Low. This fix corrects an erroneous behavior that could go unnoticed. At worst, with the fix everything will look the same.