-
Notifications
You must be signed in to change notification settings - Fork 831
Closed
Labels
Description
Hi team,
For your consideration: some methods for manipulating the LogContext
worked previously with null
values but now the nullable reference types disallow it. This occurs with 2.11.0.
PropertyEnricher.cs had #nullable enable
added to it, but value
and _value
were not changed from object
to object?
.
The documentation tells us that it is not an exception to pass null
for value
, only name
:
serilog/src/Serilog/Core/Enrichers/PropertyEnricher.cs
Lines 40 to 41 in 697a231
/// <exception cref="ArgumentNullException">When <paramref name="name"/> is <code>null</code></exception> | |
/// <exception cref="ArgumentException">When <paramref name="name"/> is empty or only contains whitespace</exception> |
Ultimately _value
is used with propertyFactory.CreateProperty(_name, _value, _destructureObjects);
which seems to tolerate null
values:
public LogEventProperty CreateProperty(string? name, object? value, bool destructureObjects = false) |
Upgrading Serilog causes compile errors were there previously were none.