Skip to content

PrincipalContext.ValidateCredentials against the local SAM store fails with a PrincipalOperationException after any successful call to ValidateCredentials against the local SAM store #106905

Open
@KaizerT

Description

@KaizerT

Description

In summary, when validating a local user, PrincipalContext.ValidateCredentials throws an exception after a single local user is verified. It doesn't matter if the credentials are correct or not, the exception is thrown. The same code works when validating against an Active Directory.

This is a duplicate of the issue below.
#83269

In the issue it is said to have been broken for version 7.0 and 8.0 and fixed last year. However we are running with 8.0 and are experiencing the same issue.

I've tried downgrading System.DirectoryServices and System.DirectoryServices.AccountManagement to 7.0 and 6.0 with the same issue.

Reproduction Steps

PrincipalContextIssueRepro.zip
Here's a small sample project that duplicates the behavior

Expected behavior

Unlimited amount of local user credentials can be verified

Actual behavior

Exception is thrown after 1 user is successfully verified. After that only that user can be verified. Exception is thrown for other users or when the first user is verified with the wrong password.

Regression?

This is a duplicate issue #83269

Known Workarounds

Workaround is restarting the application (recycle for web apps) but would break right after.

Configuration

.net 8.0.6
Windows 10 Enterprise Build 19045.4651 x64
Windows 11 Pro Build 22621.4037 x64
Vistual Studio Enterprise 2022 17.10.4

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions