diagnostics messages. Contributed by Chengbing Liu. (cherry picked from commit 57f1a01eda80f44d3ffcbcb93c4ee290e274946a)