More thorough check for managed type parameters. Fixes #14347