c# - Weird .Net 4, System.IO.FileNotFoundException when call UserPrincipal.FindByIdentity, -


i start encounter new runtime system.io.filenotfoundexception exception after upgrade system win7 x64 win 10 x64.

i have following code works perfect until now:

{     principalcontext pc = new principalcontext(contexttype.machine, environment.machinename);     userprincipal usrprin = userprincipal.findbyidentity(pc, identitytype.samaccountname, username);      if (usrprin == null) // no user exist     {         return -1;     }     // user exist      return 1;                      } 

i built project using platform target: x86, when run application, exception when call userprincipal.findbyidentity.

a first chance exception of type 'system.io.filenotfoundexception' occurred in system.directoryservices.dll first chance exception of type 'system.io.filenotfoundexception' occurred in system.directoryservices.accountmanagement.dll

all projects compile .net4 , not .net4.5

during debug now, find if change build platform target anycpu, code passed no issue.

it seems os bug! .net 4 x86 not installed or not right!, tried reinstall .net4 couldn't because installed, iran .net cleanup tool well.

any idea why exception?


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -