Avoid Annoying NullReferenceException

It seems that iterating over stack calls method can have a null DeclaringType. I don't have idea of the reason. :-(