Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Easy way to generate "System.InvalidOperationException: Nullable object must have a value."
using System;
public class Test
public static void Main()
int? nullableInt = null;
int nowInt = (int)nullableInt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment