Build with an Azure free account. Get USD200 credit for 30 days and 12 months of free services.

Start free today

This is how you get rid of null reference exceptions forever

Play This is how you get rid of null reference exceptions forever
Sign in to queue


In this episode, Rich sits down with Immo to explore how the new new nullable reference types feature works for library and framework developers.

  • [00:00] Intro
  • [00:54] What are nullable reference types?
  • [03:46] Demo time!
  • [07:13] What's flow analysis?
  • [11:48] How does Debug.Assert work?
  • [13:17] Nullability and generics
  • [19:42] What process was used to annotate the framework?
  • [24:17] How powerful is the compiler analysis?
  • [27:33] What's the philosophy on annotating interfaces and virtuals?
  • [31:42] How do I enable nullable reference types?



The Discussion

  • User profile image
    Ajay Tandon

    This is brilliant. However, when I turned nullable on I got ‘sqlnullvalueexception Data is Null’ when using entity framework core and using ToList() on the iqueryable. The stack trace is not particularly helpful, unfortunately. This all works fine when I remove the nullable from the csproj file, and I have investigated the ‘required’, with no success. Any advice on how to handle this. Is EF Core compatible with nullable?

    Thanks in advance for any insights you can provide.

Add Your 2 Cents