Fix hanging of diagnostics on Windows
Merge pull request #725 from bpindelski/rebased/develop/diagnostics_10155

Fix hanging of diagnostics on Windows (see #10155) (rebased onto develop)