public List<Application> FindAll()
{
    using (ISession NSession = SessionProvider.GetSession())
    {
        ICriteria CriteriaQuery =
            NSession.CreateCriteria(typeof(Application));
        return (List<Application>) CriteriaQuery.List<Application>();
    }
}
I am getting an exception in which application class is the following:
public class Application
{
     private string _name;
     private Developer _developer;
     private int _id;
     private List<Bug> _bugs;
    public Application()
    {
    }
    public virtual int ApplicationId
    {
        get { return _id; }
        set { _id = value; }
    }
    public virtual Developer Developer
    {
        get { return _developer; }
        set { _developer = value; }
    }
    public virtual string Name
    {
        get { return _name; }
        set { _name = value; }
    }
    public virtual List<Bug> Bugs
    {
        get { return _bugs; }
        set { _bugs = value; }
    }
}
System.InvalidCastException: Unable to cast object of type 'NHibernate.Collection.Generic.PersistentGenericBag1[BugTracker.Model.Bug]' to type 'System.Collections.Generic.List1[BugTracker.Model.Bug]'.
Here is the application.hbm.xml:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="BugTracker.Model"
                   assembly="BugTracker">
  <class name="Application" table="Applications" lazy="false">
    <id name="ApplicationId" column ="ApplicationId" type="int" unsaved-value ="0">
      <generator class ="native"></generator>
    </id>
    <property name ="Name" column="Name"/>
    <component access ="field.camelcase-underscore" name ="Developer"
               class="Developer">
      <property access ="field.camelcase-underscore" 
                column ="DeveloperFirstName" name="FirstName"/>
      <property access ="field.camelcase-underscore" 
                column="DeveloperLastName" name="LastName"/>
    </component>
    <bag cascade="all-delete-orphan"
          inverse ="true"
          name ="Bugs"
          lazy="false"
          access ="field.camelcase-underscore">
      <key column ="ApplicationId"/>
      <one-to-many class ="Bug"/>
    </bag>
  </class>
</hibernate-mapping>
I'm newbie to Nhibernate and find it very complicated. I really cannot see the issue. The exception occurs at the last line of Application Class Constructor.
 
     
     
     
     
     
    