nullable object must have a value .net core code example
Example: Nullable object must have a value.
This error occurs when you blindly call Value on a nullable type. Make sure you have a value on the nullable type (using HasValue) before calling Value on it.