NullReferenceException: Object reference not set to an instance of an object
NullReferenceException: A null value was found where an object instance was required
I want to know what conditions cause these two different messages to occur.
NullReferenceException: Object reference not set to an instance of an object
NullReferenceException: A null value was found where an object instance was required
I want to know what conditions cause these two different messages to occur.
The first one is a Exception from the Framework itself.
The second one, is someone trying to avoid the first case by throwing a custom Exception. However I think he messed up a bit: Usually you should be using a ArgumentException for this case, not a NullReference one. Exactly because it causes this kind of confusion.
Edit: As Gabriel Luci pointed out, this might come from working with Unity3D. Unity spend years being developed against the Mono Framework for Platform Independant Development (Platform Indepedance only materialized for .NET around .NET Core). So they might have followed a different pattern/set of Localisation Strings.
For Exception handling (catching, throwing your own and rethrowing), I have two Articles I link often. Those are what I base my "I think he messed up" on.