I've been a .NET developer for over a decade so here's a shameful question I've never known the answer to. I get it--if an argument is null, I can throw an ArgumentNullException. A NullReferenceException will be thrown if I try to dereference a null value.
But what if I have code like the following:
var someVitalObject = someServiceReference.GetVitalObject();
if (someVitalObject == null)
{
throw new IDontKnowWhatException(); // what exception should I throw here?
}
Now, this isn't necessarily a problem with the service for which an exception should have been thrown earlier.