Modules may exist without an Assembly,in this case the line
"method.DeclaringType.Module.Assembly.EntryPoint"
causes a NullReferenceException as Assembly == null.
This change first checks if Module.Assembly != null.