0

I've written some code to manage membership of an AD LDS container using C#. In our testing, an error is thrown when attempting to commit our changes to the DirectoryEntry if certain people are added. The code works fine if these specific users aren't included in the membership.

The detailed exception that is generated is:

System.DirectoryServices.DirectoryServicesCOMException was unhandled
HResult=-2147016657
Message=A constraint violation occurred.

Source=System.DirectoryServices
ErrorCode=-2147016657
ExtendedError=8373
ExtendedErrorMessage=000020B5: AtrErr: DSID-03152804, #1:
0: 000020B5: DSID-03152804, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 1f (member)

StackTrace:
at System.DirectoryServices.DirectoryEntry.CommitChanges()
at HCI.DirectoryServices.AdLds.Role.Save() in c:\Projects\ET\Shared\HCI.DirectoryServices\AdLds\Role.cs:line 186
at HCI.Test.ADManager.PasswordModifier.Main() in c:\Projects\ET\ADManager\HCI.Test.ADManager\Program.cs:line 303
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

From what I have read online, this message indicates there is a problem with the member attribute of the group, but I have no idea what it could be. As I stated, the same code works perfectly when these specific users are excluded. I haven't been able to find any commonality with the problem users either.

For a final kicker, if I manually add these users to the container using ADSI Edit, I can then do anything I want to with them with my code: remove, add back, add to a different container, etc.

Advice is appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sbrown
  • 171
  • 6

0 Answers0