Backport of gh-31228
Backport of gh-31228