title: ArgumentNullException was unhandled - Value cannot be null. Parameter name: first
body: <p>I am currently using the DotSpatial library for .NET (GIS Library). I am getting an error within my AppManager class. The AppManager is a Component that manages the loading of extensions (including data providers), and helps with file serialization:</p>
  
  <p><strong>Code being flagged at foreach</strong></p>
  
  <pre><code>public IEnumerable&lt;string&gt; GetDirectoriesNestedOneLevel()
  {
         // Visit each directory in Directories Property (usually set by application)
      foreach (string directory in Directories.Union(new[] { "Data Extensions", "Tools" }))
      {
          string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, directory);
  
          if (Directory.Exists(path))
          {
              yield return path;
  
              // Add all of the directories in here, nested one level deep.
              var dirs = Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly);
  
              foreach (var dir in dirs)
              {
                  yield return dir;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>ParamName</strong>           </p>
  
  <blockquote>
    <p>first</p>
  </blockquote>
  
  <p><strong>Source</strong>           </p>
  
  <blockquote>
    <p>System.Core</p>
  </blockquote>
  
  <p><strong>StackTrace</strong></p>
  
  <blockquote>
    <p>at System.Linq.Enumerable.Union[TSource](IEnumerable<code>1 first, IEnumerable</code>1 second)    at
    DotSpatial.Controls.AppManager.d__9.MoveNext()
    in c:\dev\DotSpatial\DotSpatial.Controls\Extensions\AppManager.cs:line
    581    at DotSpatial.Controls.AppManager.GetCatalog() in
    c:\dev\DotSpatial\DotSpatial.Controls\Extensions\AppManager.cs:line
    563    at DotSpatial.Controls.AppManager.LoadExtensions() in
    c:\dev\DotSpatial\DotSpatial.Controls\Extensions\AppManager.cs:line
    329    at DemoMap.MainForm..ctor() in C:\Users\Logan B.
    Lehman\Documents\DemoMap\DemoMap\MainForm.cs:line 230    at
    DemoMap.Program.Main() in C:\Users\Logan B.
    Lehman\Documents\DemoMap\DemoMap\Program.cs:line 13    at
    System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[]
    args)    at System.AppDomain.ExecuteAssembly(String assemblyFile,
    Evidence assemblySecurity, String[] args)    at
    Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br>
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br>
    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()</p>
  </blockquote>
  
  <p><strong>Any idea on what is going on here?</strong> *<em>It would be more than appreciated</em>*</p>