Most likely, you can print a string containing null characters for better diagnosis, since printing a string that contains a char zero does not usually lead to anything meaningful (this will usually be truncated in the output).
However, the best way would be Assert.EscapeNonprintableChars - to replace not only \0 , but also all non-printable characters.
source share