If you see the code, this part stackTrace = new StackTrace(); stackFrame = stackTrace.GetFrame(2); is in a try-catch block that catchs all the exceptions, also, methodBase is checked for null, so the exception is not thrown there. Also, the exception is a null reference generated in the posted method, not in any method called by it, meaning that we tried to call methods on some variable or property that was null.