When you try to validate credentials using .NET on Windows 10 you may get the rather confusing errror
System.IO.FileNotFoundException: The system cannot find the file specified.
The full exception trace looks like this
System.IO.FileNotFoundException: The system cannot find the file specified.
at System.DirectoryServices.AccountManagement.UnsafeNativeMethods.IADs.Get(String bstrName)
at System.DirectoryServices.AccountManagement.CredentialValidator.BindSam(String target, String userName, String password)
at System.DirectoryServices.AccountManagement.CredentialValidator.Validate(String userName, String password, ContextOptions connectionMethod)
at System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password, ContextOptions options)
To resolve this make sure that the RegisteredOwner and RegisteredOrganization string values are found here HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion.
More information can be found here
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6638841/
Alternatively you can make sure that your project is not running in x86 mode.
System.IO.FileNotFoundException: The system cannot find the file specified.
The full exception trace looks like this
System.IO.FileNotFoundException: The system cannot find the file specified.
at System.DirectoryServices.AccountManagement.UnsafeNativeMethods.IADs.Get(String bstrName)
at System.DirectoryServices.AccountManagement.CredentialValidator.BindSam(String target, String userName, String password)
at System.DirectoryServices.AccountManagement.CredentialValidator.Validate(String userName, String password, ContextOptions connectionMethod)
at System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password, ContextOptions options)
To resolve this make sure that the RegisteredOwner and RegisteredOrganization string values are found here HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion.
More information can be found here
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6638841/
Alternatively you can make sure that your project is not running in x86 mode.