A few diagnostics-related fixes

Closes #17765.
Closes #15524.
Closes #14772.