DirectoryEntry.Exists() throws exception for non-existent WinNT object - by Jay Logue

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 337682 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 4/10/2008 11:27:35 AM
Access Restriction Public


Contrary to the documentation the System.DirectoryServices.DirectoryEntry.Exists() method throws a COMException when presented with a path to a non-existent object using the WinNT provider (e.g. “WinNT://MyComputer/NoSuchUser,user”).  The COMException complains about the target object not being found (e.g. “The user name could not be found.”).

As the point of the Exists() method is to test for the existence of an object without the need to catch an Exception, the code is clearly buggy.
Sign in to post a comment.
Posted by Dushyant [MSFT] on 4/2/2009 at 11:34 AM
Jay, Thanks for your feedback. We are resolving this bug as won't fix.
Although the design isn't right... Apps might have been written expecting this - and the change might break those apps. The workaround is to catch the exception - not pretty, agreed, but not enough justification for a fix.
The documentation needs to be fixed and I will open a doc workitem for this.
Posted by Microsoft on 4/10/2008 at 8:33 PM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team