'UserPasswordCredential' could not be found
Are you using .NET Core? The UserPasswordCredential is not supported in .NET Core. FYI: https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/482
I also faced this issue. Hardcoding the username and the password is not a recommended way and you can use the application permissions instead of the delegated permissions. But sometimes some APIs need the delegated permissions. So I want to implement a no-user interaction method to call the Graph APIs. It looks like a deadlock.