How can I hint the C# 8.0 nullable reference system that a property is initalized using reflection

Whenever you want to tell the compiler “shut up, I know what I’m doing” in regards to nullable reference types, use the ! operator. You can fix your issue by declaring your properties like so:

public DbSet<Probe> Probes { get; set; } = null!;
public DbSet<ProbeUnitTest> ProbeUnitTests { get; set; } = null!;

Leave a Comment