Hello!
The situation is very strange, here is an example of the code that works:
string UserName = "dalcaev"; var f = cAD.GetUser("dalcaev"); MessageBox.Show(f.Name); Why doesn't it work like that?
string UserName = loginArr[0]; var f = cAD.GetUser(UserName); MessageBox.Show(f.Name); In loginArr[0] I pass "dalcaev" exactly there, but in the end I get an error, you can look at the screenshot. What's wrong? Thank! 
Did a check

В loginArr[0] точно передаю туда "user"- and judging by theWatchwindow, there is"dalcaev". - awesoonbool smsth = UserName == "user", where "user" is a string from the working version. and look at the result. - PashaPash ♦Я условно назвал "user", you only confused the responders, because now the code in question is clearly at odds with the code on your local machine. Please correct the code and screenshot so that they truly reflect the working and non-working versions. - awesoon 2:43 pm