title: DocumentCollection.Open() function not working AutoCAD API
body: <p>I'm developing an AutoCAD plugin for my application. I'm using AutoCAD 2012. Plugin opens .NET named pipe, and so I can connect to it from my desktop application very easily.</p>
  
  <p>First of all, i have created an interface. Here it is</p>
  
  <pre><code>[ServiceContract]
  public interface IConnector
  {
      [OperationContract]
      [FaultContract(typeof(Exception))]
      void GetPdfVersion(string filePath, string exportFilePath);
  }
  </code></pre>
  
  <p>My AutoCAD plugin derived from IExtensionApplication interface, so on Initialize method i've written this </p>
  
  <pre><code>this.host = new ServiceHost(typeof(Printer), new[] { new Uri("net.pipe://localhost") });
  this.host.AddServiceEndpoint(typeof(IConnector), new NetNamedPipeBinding(), "GetPdfVersion");
  this.host.Open();
  </code></pre>
  
  <p>In one of functions, I need to open document and process it.
  So, I have written folowing code</p>
  
  <pre><code>var docColl = Application.DocumentManager;
  Document curDraw = null;
  try
  {
      if (File.Exists(@"d:\1.dwg"))
      {
          curDraw = docColl.Open(@"d:\1.dwg", true, string.Empty);
      }
  }
  catch (Exception e)
  {
      Console.WriteLine(e);
  }
  </code></pre>
  
  <p>But it throws a COM exception, on the <code>curDraw = docColl.Open(@"d:\1.dwg", true, string.Empty);</code> code, with HRESULT=-2147418113</p>
  
  <p>I need Document object for processing the dwg file. Is there any possible ways to fix that error?</p>