I have a simple method which uses await
.But the problem is that as soon as i reaches to the line the execution of the program is getting stopped , i dont know why.Here is my code..
public async void GetUserdetails() {
var upn = "Custom Name";
var userLookupTask = activeDirectoryClient.Users.Where(
user => user.UserPrincipalName.Equals(
upn, StringComparison.CurrentCultureIgnoreCase)).ExecuteSingleAsync();
User userJohnDoe = (User)await userLookupTask;
Console.WriteLine(userJohnDoe.UserPrincipalName);
Console.WriteLine(userJohnDoe.DisplayName);
Console.ReadLine();
}
Any ways to get the execution running and see the values on Console.Please help.Thanks..