What is NullReferenceException? Object reference not set to an instance of an object

Matt Watson Developer Tips, Tricks & Resources, Live Queue Leave a Comment

Null reference errors are responsible for a good percentage of all application bugs. They are usually very simple problems caused by not adding additional logic to ensure that objects have valid values before using them. The following code will throw a NullReferenceException if the variable “text” being passed in is null. You can’t call ToUpper() on a null string. public …

What is an Unhandled Exception, and How to Catch All C# Exceptions

Matt Watson Developer Tips, Tricks & Resources, Live Queue Leave a Comment

What is an Unhandled Exception? An exception is a known type of error. An unhandled exception occurs when the application code does not properly handle exceptions. For example, When you try to open a file on disk, it is a common problem for the file to not exist. The .NET Framework will then throw a FileNotFoundException. This is a simple example …