-
Notifications
You must be signed in to change notification settings - Fork 831
Moar nullables #1597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moar nullables #1597
Conversation
@@ -281,7 +283,7 @@ bool TryConvertValueTuple(object value, Destructuring destructuring, Type valueT | |||
return false; | |||
} | |||
|
|||
bool TryConvertCompilerGeneratedType(object value, Destructuring destructuring, Type valueType, out LogEventPropertyValue result) | |||
bool TryConvertCompilerGeneratedType(object value, Destructuring destructuring, Type valueType, [NotNullWhen(true)] out LogEventPropertyValue? result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are nicer to consume when they're written as:
[MaybeNullWhen(false)] out LogEventPropertyValue result
I.e. the out var is not nullable, and the compiler checks that the return value has been used. (This is how Dictionary<K,V>
works when V
is a non-nullable reference type.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but LogEventPropertyValue is a reference type, so it is not comparable to the Dictionary scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question; I have a couple of things to check - will tinker and report back :-) 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any outcome from the tinkering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, hectic couple of weeks again! Starting to catch up but slow going :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no rush on my side, just making sure it hadnt slipped off your radar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :-) 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for hanging in there, mate - I think your approach is the right one, squashing now!
* Update PropertyBinder.cs * Update LoggerConfiguration.cs * Update AggregateSink.cs * Update ConditionalSink.cs * Update DisposeDelegatingSink.cs * Update DisposingAggregateSink.cs * Update FilteringSink.cs * Update RestrictedSink.cs * Update SafeAggregateSink.cs * Update SecondaryLoggerSink.cs * Update LoggingLevelSwitch.cs * Update PropertiesOutputFormat.cs * Update JsonFormatter.cs * Update JsonValueFormatterTests.cs * Update Log.cs
needs a squash