You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subscripting into collections should throw an exception if the member does not exist. For example, an Effect's collection of Techniques should raise an exception when a non-existent technique is subscripted. e.g.:
// i'm not very good at examples, sorry :(vartechnique= e.Techniques["VertexLit"];// no exception if technique existstechnique= e.Techniques["NonexistantTechnique"];// raise exception if it doesn't// helpful for many other things, too:
e.Parameters["WorldViewPosition"]= CalculateWVP();
e.Parameters["Blabla"]="sixtyten";// raise exception if parameter doesn't exist
Motivation
This would help mitigate the number of unhelpful NullReferenceExceptions thrown at the user which can be frustrating to debug and demoralizing. When these kinds of exceptions emerge, new users can feel as if MonoGame itself is broken, when really it's a tiny, easily missable detail of their own code which is very easy to pass up -- especially if it's worked in the past under other circumstances. .NET themselves acknowledge the annoying nature of the NullReferenceException, and I think it'd be beneficial if we limited the amount which the user has to deal with.
The text was updated successfully, but these errors were encountered:
The Effects semantics/register allocation is completely separate from the C# code:
Build Time
The implementation of your feature would require parsing of the effect files, and all C# files in the project for consistency.
Run Time
The current implementation provides the best frame-rate possible. Would renaming the error grant anymore insight than the Call Stack at the cost of millisecond(s) per step?
Your post here alone will help others with the same problem.
Intent
Subscripting into collections should throw an exception if the member does not exist. For example, an Effect's collection of Techniques should raise an exception when a non-existent technique is subscripted. e.g.:
Motivation
This would help mitigate the number of unhelpful NullReferenceExceptions thrown at the user which can be frustrating to debug and demoralizing. When these kinds of exceptions emerge, new users can feel as if MonoGame itself is broken, when really it's a tiny, easily missable detail of their own code which is very easy to pass up -- especially if it's worked in the past under other circumstances. .NET themselves acknowledge the annoying nature of the NullReferenceException, and I think it'd be beneficial if we limited the amount which the user has to deal with.
The text was updated successfully, but these errors were encountered: