Resolves: RHEL-13790
Resolves: RHEL-4074
Imported from dotnet-sig/dotnet8.0 commit ecce7a2b28: ecce7a2b28 Resolves: RHBZ#2224124
ecce7a2b28