В приведенном ниже коде влияет ли удаление PrincipalCtx на userPrin?
Используется ли PrincipalCtx только для поиска user или он каким-то образом остается связанным с объектом userPrin?
UserPrincipal userPrin= null;
using(PrincipalContext principalCtx as new PrincipalContext(ContextType.Domain)){
userPrin= UserPrincipal.FindByIdentity(principalCtx, IdentityType.SamAccountName, "first.last");
}
return userPrin;
Подробнее здесь: https://stackoverflow.com/questions/219 ... osable-one