InvalidOperationException from DirectorySearcher
In .NET 2.0, a variety of new search operations are included in the DirectorySearcher class. However, not all of these options work with every single version of ADSI on each Windows platform. For example, Windows XP as of Service Pack 2, and all previous operating systems, does not support extended distinguished name (DN) searches (see Chapter 5).
Trying to use an unsupported search feature will result in this exception with the stack trace pointing to the DoSearchPrefs method. Unfortunately, the error message does not explain that the option was unsupported on our platform, so we are often left scratching our heads. Now we know!
A future version of the .NET Framework may provide a more informative error message here. Additionally, future versions of the ADSI that are included with Windows service packs may introduce these features to down-level clients.