Skip to content

Commit d3d36f6

Browse files
committed
Change the behaver when ToString() return null.
1 parent 642c817 commit d3d36f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Serilog.Sinks.Console/Sinks/SystemConsole/Formatting/ThemedJsonValueFormatter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ protected override int VisitDictionaryValue(ThemedValueFormatterState state, Dic
154154
: ConsoleThemeStyle.Scalar;
155155

156156
using (ApplyStyle(state.Output, style, ref count))
157-
JsonValueFormatter.WriteQuotedJsonString((element.Key.Value?.ToString() ?? "null"), state.Output);
157+
JsonValueFormatter.WriteQuotedJsonString((element.Key.Value ?? "null").ToString() ?? "", state.Output);
158158

159159
using (ApplyStyle(state.Output, ConsoleThemeStyle.TertiaryText, ref count))
160160
state.Output.Write(": ");
@@ -248,7 +248,7 @@ int FormatLiteralValue(ScalarValue scalar, TextWriter output)
248248
}
249249

250250
using (ApplyStyle(output, ConsoleThemeStyle.Scalar, ref count))
251-
JsonValueFormatter.WriteQuotedJsonString(value.ToString() ?? "null", output);
251+
JsonValueFormatter.WriteQuotedJsonString(value.ToString() ?? "", output);
252252

253253
return count;
254254
}

0 commit comments

Comments
 (0)