We have large enterprise system. Some of the AD users do not have user profiles so the code throws a null point exception. When check in user profile list, they do not have user profiles. Why is that? My production access will be removed very soon.
You can edit the User Profile Service Synchronization Connection to Active Directory.
Central Admin --> Manage Service Applications --> User Profile Service --> Configure Synchronization Connections --> Select Connection --> Edit
Then make sure all the required OUs are selected. Thereafter do a full synchronization for the user profile service.