My ListServerAttributes query doesn't work under 11038.

Jan 30, 2012 at 1:21 PM

This used to work in v202 but doesn't work in source code 11038:

 

    var serverName2 = context.ListServerAttributes("servername").Single().Value.ToString();
    Console.WriteLine("Server = {0}", serverName2.Substring(3, serverName2.IndexOf(",") - 3));

 

I get System.ArgumentNullException: "A naming context must be provided via mapping or querying. Parameter name: namingContext"

with stack trace:

 

   at LinqToLdap.QueryCommands.QueryCommand.SetDistinguishedName(String namingContext) in C:\Documents and Settings\Me\My Documents\Visual Studio 2010\Source Code\LinqToLdap\LinqToLdap-11038\Trunk\LinqToLdap\QueryCommands\QueryCommand.cs:line 66
   at LinqToLdap.QueryCommands.FirstOrDefaultQueryCommand.Execute(DirectoryConnection connection, SearchScope scope, Int32 maxPageSize, ILinqToLdapLogger log, String namingContext) in C:\Documents and Settings\Me\My Documents\Visual Studio 2010\Source Code\LinqToLdap\LinqToLdap-11038\Trunk\LinqToLdap\QueryCommands\FirstOrDefaultQueryCommand.cs:line 30
   at LinqToLdap.DirectoryQueryProvider.Execute(Expression expression) in C:\Documents and Settings\Me\My Documents\Visual Studio 2010\Source Code\LinqToLdap\LinqToLdap-11038\Trunk\LinqToLdap\DirectoryQueryProvider.cs:line 72
   at LinqToLdap.QueryProvider.Execute[TResult](Expression expression) in C:\Documents and Settings\Me\My Documents\Visual Studio 2010\Source Code\LinqToLdap\LinqToLdap-11038\Trunk\LinqToLdap\QueryProvider.cs:line 75
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
   at LinqToLdap.DirectoryContext.ListServerAttributes(String[] attributes) in C:\Documents and Settings\Me\My Documents\Visual Studio 2010\Source Code\LinqToLdap\LinqToLdap-11038\Trunk\LinqToLdap\DirectoryContext.cs:line 239
   at LDAPConfigurationTests1.Program.Main(String[] args) in C:\Documents and Settings\Me\my documents\visual studio 2010\Projects\LDAPConfigurationTests1\LDAPConfigurationTests1\Program.cs:line 21
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

 

Coordinator
Jan 31, 2012 at 3:24 AM

I got a little overzealous with my null checking.  This will be fixed in the next check-in.  Thanks for catching this.