Net 6 nullable 不对所有类型发出警告

Net 6 nullable not giving warning for all types

使用 Net 6 <Nullable>enable</Nullable> 我有 class:

public class File {
  public Int32 Id { get; set; }
  public Byte[] Content { get; set; }
  public DateTime Created { get; set; }
  public Guid Key { get; set; }
  public String Name { get; set; }
  
  public FileType FileType { get; set; }
}

为什么我会收到警告

Non-nullable property '...' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. 

在所有属性中但不在:

Int32 Id
DateTime Created
Guid Key

可为空的引用类型只影响引用类型。值类型永远不能为空,因此无需检查或警告它们是否为空。