title: "Class does not support automation" error when using own class from JScript
body: <p>I have a project which exposes object model to use by different types of clients. Written in .Net 3.5 it exposes classes to COM. Problem is while all seems to work from test VB6 client, I faced strange errors while trying to automate it with JScript and Windows Script Host.</p>
  
  <p>Here's code snippet:</p>
  
  <pre><code>var scComponent = new ActiveXObject("Mine.SCComponent");
  var Prescription = new ActiveXObject ("Mine.CardHolderNewServedPrescriptionData");
  
  Prescription.DiagnosisId = "Test Diagnosis";
  Prescription.Date = "2009-01-01";
  
  Prescription.DrugId = 1121;
  Prescription.LpuId = 19;
  Prescription.Number = 1024;
  Prescription.OperatorId = 0;
  Prescription.PhysicianId = 13;
  Prescription.Quantity = 800;
  Prescription.Series = 144;
  //Prescription.ServedDate = "2009-01-01";
  //Prescription.ServedDrugId = 1123;
  //Prescription.ServedQuantity = 600;
  //Prescription.Status = 0;
  //Prescription.RecourseDate = "2009-01-01";
  
  var addResult = scComponent.AddCardHolderServedPrescription(Prescription);
  </code></pre>
  
  <p>Got following problems while running it:</p>
  
  <ul>
  <li>commented lines failing with error "Object does not support such property or method"</li>
  <li>Prescription.Date is defined as System.DateTime, but assignment of JScript Date does not work here - but it seems to accept (or somehow cast) string date.</li>
  <li>final line with AddCardHolderServedPrescription call fails with "Class does not support automation" error.</li>
  </ul>
  
  <p>Calls to other scComponent methods passing correctly, so I suppose there are some problems with CardHolderNewServedPrescriptionData type. Now I need some clues to troubleshoot it - script error messages aren't too informative. Google searches return no meaningful information about diagnostics methods.</p>
  
  <p>Again, it works both in my C# tests and VB6 client, but not JScript. Thanks for any ideas.</p>
  
  <p>Type definitions and interface fragments goes below.</p>
  
  <pre><code>[Guid("08D183AF-BE28-4638-BAC0-C568C0FEAD45")]
  [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
  public interface ICardHolderNewServedPrescriptionData
  {
      int Series { get; set; }
      int Number { get; set; }
      DateTime Date { get; set; }
      string DiagnosisId { get; set; }
      int DrugId { get; set; }
      int Quantity { get; set; }
      int LpuId { get; set; }
      int PhysicianId { get; set; }
      int OperatorId { get; set; }
      int CategoryId { get; set; }
      int Status { get; set; }
      DateTime RecourseDate { get; set; }
      DateTime ServedDate { get; set; }
      int ServedDrugId { get; set; }
      int ServedQuantity { get; set; }
  }
  
  [Guid("E0842E24-163E-4580-9AD6-1593F781D314")]
  [ClassInterface(ClassInterfaceType.None)]
  [ProgId("Mine.CardHolderNewServedPrescriptionData")]
  public class CardHolderNewServedPrescriptionData : ICardHolderNewServedPrescriptionData
  {
      public int Series { get; set; }
      public int Number { get; set; }
      public DateTime Date { get; set; }
      public string DiagnosisId { get; set; }
      public int DrugId { get; set; }
      public int Quantity { get; set; }
      public int LpuId { get; set; }
      public int PhysicianId { get; set; }
      public int OperatorId { get; set; }
      public int CategoryId { get; set; }
      public int Status { get; set; }
      public DateTime RecourseDate { get; set; }
      public DateTime ServedDate { get; set; }
      public int ServedDrugId { get; set; }
      public int ServedQuantity { get; set; }
  }
  
  [Guid("7C1331D7-320D-4201-889C-AF56BFE0D71A")]
  [ClassInterface(ClassInterfaceType.None)]
  [ProgId("Mine.SCComponent")]
  public class SCComponent : ISCComponent
  {
  /*class logic goes here*/
          public int AddCardHolderServedPrescription(CardHolderNewServedPrescriptionData newServedPrescriptionData)
      {
  /*method body*/
              }
      }
  </code></pre>