title: NullReference when disposing session with transaction
body: <p>Usually it works fine but in some conditions (I can't reproduce it) I receive NullReferenceException with stacktrace:</p>
  
  <pre>
  
     at Npgsql.NpgsqlCommand.ClearPoolAndCreateException(Exception e) in C:\projects\Npgsql2\src\Npgsql\NpgsqlCommand.cs:line 1505
     at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) in C:\projects\Npgsql2\src\Npgsql\NpgsqlCommand.cs:line 650
     at Npgsql.NpgsqlCommand.ExecuteBlind() in C:\projects\Npgsql2\src\Npgsql\NpgsqlCommand.cs:line 499
     at Npgsql.NpgsqlTransaction.Rollback() in C:\projects\Npgsql2\src\Npgsql\NpgsqlTransaction.cs:line 185
     at Npgsql.NpgsqlTransaction.Dispose(Boolean disposing) in C:\projects\Npgsql2\src\Npgsql\NpgsqlTransaction.cs:line 141
     at NHibernate.Transaction.AdoTransaction.Dispose(Boolean isDisposing) in p:\nhibernate-core\src\NHibernate\Transaction\AdoTransaction.cs:line 368
     at NHibernate.Impl.SessionImpl.Close() in p:\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 380
     at NHibernate.Impl.SessionImpl.Dispose(Boolean isDisposing) in p:\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 1738
     at NHibernate.Impl.SessionImpl.Dispose() in p:\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 1709
  </pre>
  
  <pre><code>    public virtual IEnumerable&lt;User.PublishedInfo&gt; GetUsersByXP(int count)
      {
          using (ISession session = SessionFactory.OpenSession())
          {
              using (session.BeginTransaction())
              {
                  var result = session.CreateCriteria&lt;User&gt;()
                      .SetProjection(PublishedUserProjections)
                      .AddOrder(Order.Desc("XP"))
                      .SetMaxResults(count)
                      .SetResultTransformer(Transformers.AliasToBean&lt;User.PublishedInfo&gt;())
                      .List&lt;User.PublishedInfo&gt;();
  
                  foreach (var r in result)
                      r.Initialize();
  
                  session.Transaction.Commit();
  
                  return result; // this line
              }
          }
      }
  </code></pre>
  
  <p>What can be possible wrong here?</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>Sometimes in the same code fragment (but in BeginTransaction) I receive an exception "Timeout while getting a connection". Perhaps this is somehow related.</p>