Obsidian
Obsidian copied to clipboard
Enable nullable reference types
Adding this feature was decided by a discord poll. Nullable annotation should be enabled in the whole solution.
Can I have this issue assigned to me?
I'm presently requesting further information on Discord. Once I have a better understanding of the full requirements through Discord conversations, I'll come back here to summarize them for documentation purposes.
After discussing the issue in more detail on Discord, the objectives are:
- Add the nullable annotation
?
to all reference types.- This is regardless of the use-type (fields, properties, method arguments, local variables, etc.).
The use-case of the reference type should be taken into account when adding the annotation, to ensure it is only added where the intent is to allow null
values. For example, the following snippet should mark the argument string text
as nullable (string? text
) since null
is explicitly handled.
public ChatMessage AppendText(string text) {
if (Text is null)
Text = text;
else
Text += text;
return this;
}
In cases where the intent cannot be easily inferred as allowing the use of null
values, then it should be explicitly defined that null
is not supported, along with a TODO
comment:
#nullable disable // TODO: resolve nullability
private string superWeirdBehavingString;
#nullable restore
Note: Formatting simplified for the sake of comment brevity.
Unfortunately, I keep running out of time to work on this; I apologize, I'm relinquishing the assignment.
that's fine, no apologies needed. you were willing to put your free time into this project, yet did not have enough to actually do so. I understand :)
That's fine, thanks for letting us know!
[...] you were willing to put your free time into this project, yet did not have enough to actually do so. [...]
That's why open source is open source - everyone that wants to do this can do it.
Has this been enabled yet? I'm not sure... Please close this issue if it has been enabled.
Closing as its enabled~