Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Unexpected behavior may occur when you use the System.DirectoryServices namespace with the .NET Framework 1.1 SP1 and the .NET Framework 1.0 SP3


View products that this article applies to.

Symptoms

If you have installed the Microsoft .NET Framework 1.1 Service Pack 1 (SP1) or the .NET Framework 1.0 Service Pack 3 (SP3), you may receive error messages or experience unexpected behavior when you use the System.DirectoryServices namespace. These errors may occur when you perform different types of operations on PropertyValueCollection class can generate these errors.�For example, you may receive one of the following error messages:
Error message 1
Operation is not valid due to the current state of the object.
Error message 2
An unhandled exception of type System.InvalidOperationException' occurred in mscorlib.dll.
Error message 3
80004005 - Unknown Error
Error message 3 occurs when the credentials in a DirectoryEntry are authenticated, typically on a RefreshCache operation. For example:
DirectoryEntry de = new DirectoryEntry(sLDAP, sUsername, sPassword, AuthenticationTypes.Secure);de.RefreshCache();
Error message 4
Not Implemented
You may recieve error message 4 during a bind operation. Notice that the bind connection will not occur until an operation is performed. If a RefreshCache method operation is not performed, the failure may occur later in the code. For example, the failure may occur during a FindAll method operation.
DirectoryEntry de = new DirectoryEntry(strLDAP);
//  Bind not performed yet
DirectorySearcher mySearcher = new DirectorySearcher(de);
//the bind has not occured yet - but will happen when the next line executes
//  this line could generate the error Not Implemented
SearchResultCollection result = mySearcher.FindAll();

↑ Back to the top


Resolution

To resolve this problem, you must apply hotfix 835763. Hotfix 835763 is a prerequisite for the .NET Framework 1.1 SP1 and the .NET Framework 1.0 SP3. This hotfix is part of Microsoft Windows XP Service Pack 2 (SP2) and Microsoft Windows Server 2003 Service Pack 1 (SP1). Earlier versions of these operating systems require this hotfix. For example, Microsoft Windows 2000 Service Pack 4 (SP4), Windows Server 2003, and Windows XP SP1 require this hotfix.

The classes in the System.DirectoryServices namespace wrap ADSI functionality. The System.DirectoryServices namespace needs the new functionality to exist in the underlying ADSI technology that hotfix 835763 provides. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
835763� IADs::Put/PutEx or IADsPropertyList::PutPropertyItem calls may not accumulate
Because hotfix 835763 updates the underlying ADSI objects, you can install this hotfix either before or after you install the .NET Framework 1.0 SP3 or the .NET Framework 1.1 SP1.

↑ Back to the top


More information

You can perform multiple Add operations without generating an error. For example, the following code does not generate an error:
De.Properties["phonenumber"].Add("111");
De.Properties["phonenumber"].Add("222");
However, if you perform different operations, an error is generated. The following example tries to perform an Add operation that is followed by a Remove operation. The following code generates an error:
De.Properties["phonenumber"].Add("111");
De.Properties["phonenumber"].Remove("222");
If you perform operations that use an index, an error is generated. For example, the following code generates an error:
De.Properties["phonenumber"][0] = "111-222";

↑ Back to the top


Keywords: KB886541, kbprb

↑ Back to the top

Article Info
Article ID : 886541
Revision : 10
Created on : 12/1/2007
Published on : 12/1/2007
Exists online : False
Views : 563