serilog-sinks-richtextbox icon indicating copy to clipboard operation
serilog-sinks-richtextbox copied to clipboard

Logging a null character causes an exception

Open eemitev opened this issue 1 year ago • 3 comments

Serilog appears to handle NULL characters fine but printing it to a RichTextBox causes an issue. If there is a NULL character in a string that is being logged, we end up with an unhandled exception.

msg = "\0";
Log.Information("{msg}", msg);

eemitev avatar Mar 28 '23 21:03 eemitev

@eemitev Does the Console sink support NULL characters? What would would you expect to see on the RichTextBox for non-printable characters like these?

augustoproiete avatar Mar 28 '23 21:03 augustoproiete

The Console Sink appears to print garbage instead of the NULL character. My expectation would be to get a Unicode Symbol. Specifically U+2400 ␀ SYMBOL FOR NULL

eemitev avatar Mar 28 '23 22:03 eemitev

Same problem with some other chars like: Log.Information("\u0002"); Log.Information("\u0002");

patiqs avatar Nov 17 '23 11:11 patiqs