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.

C#8 Nullable References

See original GitHub issue

Hi! Your article was very nice, ty for that. We’re using the new feature from c# to annotate nullable reference types with poco classes. Since the new feature requires properties to be initialized if not mentioned in a constructor we came up with this pattern:

public class ModelPoco
{
  public User CurrentUser { get; set; } = default!;
}

This way the adaption on legacy code is quite simple by just appending ` = default!;" to each property.

Could your extension help to avoid this additional code?

Best, Bernhard

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stijnherremancommented, Apr 28, 2020

For anyone trying out this library with VS Code: DiagnosticSuppressor is not yet supported by OmniSharp (https://github.com/OmniSharp/omnisharp-roslyn/issues/1711) so the Problems panel will still show the warnings.

1reaction
cezarypiatekcommented, Mar 17, 2020

@SeriousM I’ve just released version 2.1.31 with the requested feature. Please let me know if it works as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Essential .NET - C# 8.0 and Nullable Reference Types
There's an inconsistency between reference types and value types (following the introduction of Nullable<T>) in that value types are nullable when decorated ...
Read more >
Null reference types - proposal - C# 8.0 draft feature ...
Null guard guidance​​ As a feature, nullable reference types allow developers to express their intent, and provide warnings through flow analysis ...
Read more >
Nullable reference types in C# 8.0
Nullable reference types are a new feature in C# 8.0. They allow you to spot places where you're unintentionally dereferencing a null value ......
Read more >
What are nullable reference types in C# 8.0?
Reference types are objects that are stored on the heap. When an object has not been assigned to a reference type, the value...
Read more >
Using C# 8 and Nullable Reference Types in .NET Framework
Globally enabling nullable reference types can only be done with the new project format. Nullability can be changed on a per-file or per-line ......
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