question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Following nullable reference types

See original GitHub issue

I’ve come to realize that I’m now basically putting [NotNull] everywhere.

Maybe you’ve heard about the proposal for nullable reference types that will make unqualified reference types be non-nullable by default. (champion)

Not sure how likely that is to make it, but it’s one of the more popular proposals.

I think for NSwag, it makes sense to have a mode where the [NotNull] is implicit on everything: Properties, return values and parameters - and then have another attribute [Null] or [CanBeNull].

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
RicoSutercommented, Sep 12, 2017

The attributes are also defined in https://www.nuget.org/packages/ReSharper.Annotations/

The attributes in NJS are also allowed for the return type, eg.:

[return: NotNull]
0reactions
RicoSutercommented, Sep 12, 2017

CanBeNullAttribute, but its not yet in NJsonSchema.Annotations (you have to implement it yourself). Ill add it just now…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nullable Reference types in C# – Best practices
In this tutorial, I look at the state of the Nullable Reference Types feature in C#, one year after its initial release.
Read more >
The annotation for nullable reference types should only be ...
I have a console app to try out the C# 8 null reference types. Switched the project to build with lang ver C#...
Read more >
Nullable reference types
Nullable reference types refers to a group of features enabled in a nullable aware context that minimize the likelihood that your code causes ......
Read more >
Proposal: Nullable reference types and nullability checking ...
Nullable reference types are helpful, in that they help find code that may dereference null and help guard it with null checks. Making...
Read more >
Strategies for Implementing Nullable Reference Types in .NET
Nullable reference types offer a way to explicitly declare whether a reference type can be null. In C#, this feature is compile-time only....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found