The NullReferenceException error is easy to implement. Often it is because the object is not initialized. But there are many other reasons too.
You can check the following examples, or refer to this link:What is a NullReferenceException, and how do I fix it?.
using System;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
try
{
object o = null;
int d = (int)o;
Console.WriteLine(d);
}
catch (NullReferenceException ex)
{
Console.WriteLine("ex.Message:" + ex.Message);
Console.WriteLine("ex.StackTrace:" + ex.StackTrace);
Console.ReadLine();
}
}
}
}
Uncheck "Break when...", and you can get the information directly in the catch (if you want to check it again, you can add a breakpoint to the error line, etc.).

Eliminating this error basically requires checking that the error object is initialized or not null.