'Blazor Modal declaration throws CS8625 upon compilation

I'm utilizing the Blazorise Modal feature (as seen here). I'm following the documentation via the following code:

<Modal @ref="ModalRef1">
  <ModalContent Centered>
    <ModalHeader>
      <ModalTitle>Sample Title</ModalTitle>
    </ModalHeader>
    <ModalBody>
      <Field>
        <FieldLabel>Sample Field Content</FieldLabel>
      </Field>
    </ModalBody>
    <ModalFooter>
      <Button Color="Color.Warning" Clicked="@HideModal1">OK</Button>
    </ModalFooter>
  </ModalContent>
</Modal>

With the following instance declaration:

@code{
  private Modal ModalRef1 = new Modal();
}

For some reason, the HMTL declaration throws a "Cannot convert null literal to non-nullable reference type" error for each HTML declaration. Given that I'm using a LOT of Modal dialogs throughout the project, you can see how this would get annoying. How do I fix this? #pragma warning disable CS8625 doesn't work, and the Modal C# class has no other constructor than the default.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source